URL mapping for self hosted WCF services
I have a WCF service DLL and when I debug it gets auto hosted and this custom URL mapping works:
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "widget/{myid}")]
public Widget GetWidget(string myid) {...
My config file has:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c03f5f7f11d50a3b" />
</modules>
</system.webServer>
However I want to host insid开发者_如何学运维e my own service so I think now instead it uses the system.serviceModel
section of the config instead and so I can't use System.Web.Routing.UrlRoutingModule
.
I have the self hosted service working; however, it is automatically calling my URL GetWidget
instead of widget/{myid}
. So it is not using my WebInvoke
attribute.
If I'm manually hosting my WCF service in my own Windows NT Service via a ServiceHost object, how can I still support custom URLs with the same type of mapping?
精彩评论