access_time 3 years ago visibility1336 comment 0 languageEnglish

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

info Last modified by Raymond at 3 years ago * This page is subject to Site terms.

More from Kontext

local_offer xml-rpc

visibility 234
thumb_up 1
access_time 3 years ago

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

open_in_new AspNetCore.XmlRpc

local_offer xml-rpc

visibility 350
thumb_up 0
access_time 3 years ago

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

open_in_new AspNetCore.XmlRpc

local_offer xml-rpc

visibility 2058
thumb_up 0
access_time 3 years ago

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

open_in_new AspNetCore.XmlRpc

info About author

comment Comments (0)

comment Add comment

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

No comments yet.

Dark theme mode

Dark theme mode is available on Kontext.

Learn more arrow_forward

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.

Learn more arrow_forward