Search code examples
asp.netwcfurl-routingwcf-web-apiself-hosting

Using MVC routing engine from a self hosted dll (outside asp.net)?


I'm using WCF Web API to create a self-hosted/InProcess REST Service (HttpServiceHost) that the client app will use. All the examples for the web api use ASP.Net routing engine. Would it be possible to use the routing engine outside of Asp.net?

To give you an idea what i'm doing, here is the contructor of my Service Class that the client will new up:

    Public Sub New()

    ObjectFactory.Initialize(Sub(x)
                                 x.For(Of IIssueTrackerRepository)().Use(Of IssueTrackerRepository)().Ctor(Of String).Is(ConfigurationManager.ConnectionStrings("Dev").ConnectionString)
                                 'x.ForConcreteType(Of IssueTrackerResource)().Configure.Ctor(Of String).Is(ConfigurationManager.ConnectionStrings("Dev").ConnectionString)
                             End Sub
    )

    _host = New HttpServiceHost(ObjectFactory.GetInstance(Of IssueTrackerResource), "http://localhost:8000")
    _host.Open()
End Sub

If you can link any examples, it would be extremely helpful.


Solution

  • As far as I know: not yet. But as Web API is still under development it may be part of a future Preview.