I\'m using Clemens Vasters\' XML-RPC implementation to implement an XML-RPC endpoint. When I host the service in a console application, it works fine.
I\'d like to h
Here are the steps to get this working:
Microsoft.Samples.XmlRpc
, TinyBlogEngine
and TinyBlogEngineClient
.TinyBlogEngineWeb
)In the new project reference Microsoft.Samples.XmlRpc
and TinyBlogEngine
.
Add a test.svc file to this web application which looks like this:
<%@ ServiceHost Language="C#" Debug="true" Service="TinyBlogEngine.BloggerAPI, TinyBlogEngine" %>
Add a XmlRpcEndpointBehaviorExtension
class to the new project:
namespace TinyBlogEngineWeb
{
public class XmlRpcEndpointBehaviorExtension : BehaviorExtensionElement
{
protected override object CreateBehavior()
{
// this comes from Microsoft.Samples.XmlRpc
return new XmlRpcEndpointBehavior();
}
public override Type BehaviorType
{
get { return typeof(XmlRpcEndpointBehavior); }
}
}
}
Finally the system.serviceModel
part of web.config
should look like this:
<system.serviceModel>
<services>
<service name="TinyBlogEngine.BloggerAPI" behaviorConfiguration="returnFaults">
<endpoint address="/blogger"
binding="webHttpBinding"
contract="TinyBlogEngine.IBloggerAPI"
behaviorConfiguration="xmlRpcBehavior" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="xmlRpcBehavior">
<xmlRpc/>
</behavior>
</endpointBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add name="xmlRpc"
type="TinyBlogEngineWeb.XmlRpcEndpointBehaviorExtension, TinyBlogEngineWeb" />
</behaviorExtensions>
</extensions>
</system.serviceModel>
Finally modify the console client application to use the address of the web project and test:
Uri blogAddress = new UriBuilder(
Uri.UriSchemeHttp,
"localhost",
1260, // use the appropriate port here
"/test.svc/blogger"
).Uri;
Tested with Windows Live Writer and the console client application. You can download my test solution from here.