Hosting WCF Services in ASP.Net Core

So, I did this thing. If anybody is interested.

https://github.com/wasabii/Cogito.AspNetCore.ServiceModel/

It lets you host WCF services (real WCF services) in ASP.Net Core. You can attach ServiceHost instances to the IApplicationBuilder pipeline. Using branches, maps, and all the other jazz you get with ASP.Net Core.

It does require you to run it in the full framework, of course. So, Windows-only. But it lets you use Kestrel and stuff.

Supports Text and MTOM encoding. Can even do fun stuff like this:

// if mime type is multipart, route to MTOM version of service app.MapWhen( i => new ContentType(i.Request.ContentType).MediaType == "multipart/related", i => ConfigureServiceHost<TServiceType, TContractType, AspNetCoreBasicMtomBinding>(i, path)); // if mime type is not multipart, route to text version of service app.MapWhen( i => new ContentType(i.Request.ContentType).MediaType != "multipart/related", i => ConfigureServiceHost<TServiceType, TContractType, AspNetCoreBasicBinding>(i, path)); 

submitted by /u/wasabiiii
[link] [comments]

Leave a Reply