By using this site, you acknowledge that you have read and understand our Cookie and Privacy policy. Your use of Kontext website is subject to this policy. Accept

How to Use AspNetCore.XmlRpc

766 views last modified about 2 years ago Raymond


This post provides the detailed steps about how to use AspNetCore.XmlRpc in your .net core projects.

1. Install the package

You can install the package through NuGet PowerShell module:

Install-Package AspNetCore.XmlRpc

2. Configurations

In your appsettings.json, add the following configuration section under root:

"XmlRpc": {
     "GenerateSummary": "true",
     "SummaryEndpoint": "/api/xmlrpc/summary",
     "RsdEndpoint": "/api/xmlrpc/rsd",
     "Endpoint": "/api/xmlrpc/endpoint",
     "EngineName": "AspNetCore.XmlRpc",
     "BlogIdTokenName": "blogId",
     "HomePageEndpointPattern": "/Blog/{blogId}",
     "ManifestEndpoint": "/api/xmlrpc/manifest"

Configuration item Description Sample value
GenerateSummary Whether to enable summary endpoint true
SummaryEndpoint URL for summary endpoint /api/xmlrpc/summary
RsdEndpoint URL for Real Simple Discovery end point. This is used by client tools like Open Live Writer to detect services /api/xmlrpc/rsd
Endpoint URL for the main remote procedure calls endpoint /api/xmlrpc/endpoint
EngineName Engine name that implemented the service AspNetCore.XmlRpc
BlogIdTokenName The token name for blogId. blogId
HomePageEndpointPattern Blog home page URL /Blog/{blogId}
ManifestEndpoint URL for manifest endpoint which describe the capabilities of MetaWeblog implementation. /api/xmlrpc/manifest

3. Change Startup.cs class

3.1 Register service

You need to implement your own IMetaWeblogXmlRpcService.

// This method gets called by the runtime. Use this method to add services to the container.
         public void ConfigureServices(IServiceCollection services)
             // Configure XmlRpc

            // Add meta weblog
             services.AddMetaWeblog<MetaWeblogXmlRpcService, DefaultMetaWeblogEndpointProvider>();


3.2 Use middleware

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IDatabaseInitializer dbInitializer)



            // Use XmlRpc middleware

            app.UseMvc(routes =>
                     name: "default",
                     template: "{controller=Home}/{action=Index}/{id?}");
                     name: "areas",
                     template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");


3.3 Implement your own MetaWeblog XML-RPC services.

You can also inject any scoped or singleton services into your own service. For example the following sample shows that the service depends on a number of other services.

public class MetaWeblogXmlRpcService : IMetaWeblogXmlRpcService
         private readonly IConfigService configService;
         private readonly IContextUnitOfWork unitOfWork;
         private readonly UserManager<ApplicationUser> userManager;
         private readonly SignInManager<ApplicationUser> signInManager;
         private readonly ILogger<MetaWeblogXmlRpcService> logger;
         private readonly IHttpContextAccessor contextAccessor;
         private readonly IOptions<BlogConfig> blogOptions;
         private readonly IOptions<SiteConfig> siteOptions;
         private readonly IHostingEnvironment environment;

        public MetaWeblogXmlRpcService(IConfigService configService,
             IContextUnitOfWork unitOfWork,
             UserManager<ApplicationUser> userManager,
             SignInManager<ApplicationUser> signInManager,
             ILogger<MetaWeblogXmlRpcService> logger,
             IHttpContextAccessor contextAccessor,
             IOptions<BlogConfig> blogOptions,
             IOptions<SiteConfig> siteOptions,
             IHostingEnvironment environment)



3.5 Add links to your blog home page

This step is necessary to ensure that client tools like Open Live Writer can automatically detect the settings.

<link rel="EditURI" type="application/rsd+xml" title="RSD" href="@string.Concat(options.Value.RsdEndpoint,'/','myblogid' )" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="@string.Concat(options.Value.ManifestEndpoint,'/','myblogid' )" />

4. Sample project

Related pages

AspNetCore.XmlRpc 1.0.0-alpha.6 is ready

126 views   0 comments last modified about 2 years ago

Release date 2018-03-03 Changes Added PostId (attribute postid in MetaWeblog) into the predefined data model for PostInfo. public class PostInfo &nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [DataMember(Name = "title")] ...

View detail

Endpoints in AspNetCore.XmlRpc Explained

230 views   0 comments last modified about 2 years ago

There are four endpoints exposed by the middleware: summary, RSD, manifest for blog capability and RPC call main endpoint.

View detail

XML-RPC Library for ASP.NET Core 2.0

947 views   0 comments last modified about 2 years ago

This is my first contribution in open source world. It is forked from XmlRpcMvc project in Github.

View detail

Add comment

Comments (0)

No comments yet.


  • enquiry[at]