Coder Social home page Coder Social logo

cogito.aspnetcore.servicemodel's Introduction

Cogito.AspNetCore.ServiceModel

WCF support for ASP.Net Core

Provides middleware for ASP.Net Core for wiring up a WCF ServiceHost instance and directing requests to it. This is a bit more complicated than just establishing a binding and dispatcher.


public void ConfigureServices(IServiceCollection services)
{
    services.AddServiceModel();
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    app.UseServiceHost<MathService>("/math");
}

I've done a few things internally that are sort of weird.

Each invocation of UseServiceHost starts up a ServiceHost instance. This service host is configured by default with bindings that establish a AspNetCoreTransport. The transport generates ReplyChannels which sets up an inbound delivery queue based on the binding properties. As ASP.Net Core requests arrive, they are dispatched into the router where the hunt for a queue that they should be put into. The ReplyChannelListener dequeues these requests and enters them into the WCF pipeline. Reply messages likewise write back to the originating ASP.Net core Response.

Internally a non-standard ListenURI is set up for each invocation of UseServiceHost. These each get a "Router ID", which is a GUID that idenfies the target ServiceHost instance. This can probably go away now that I can get access to the server addresses of Kestrel and such. The main problem here is the branching paths in ASP.Net are not known until a request traverses them. So, I can't determine the path of the service until a request comes in. WCF makes this all very hard.

This lets us use the existing ServiceHost class. And thus eventually piggyback on existing ServiceHost extensions: like Autofac integration. And it keeps the dispatch/contract discovery stuff in WCF.

The ServiceHost is automatically configured with service metadata endpoints at ?wsdl, and a help page, like most standard WCF services. A channel dispatcher message inspector is used to rewrite router URLs in the response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.