How to initialize Routing service? RRS feed

  • Question

  • Hi,

    I have setup a rounting service like this:

    <%@ ServiceHost Language="C#" Debug="true" Service="System.ServiceModel.Routing.RoutingService,System.ServiceModel.Routing, version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>

    And I do my initialization in the "AppInitialize" method located in App_Code. 

    But that sucks to be forced to distribute source code. There has to be a better way?

    So I thought I could provide create a factory class implementing ServiceHostFactoryBase. But I cant create a new instance of System.ServiceModel.Routing.RoutingService (no constructors).

    Any good tips here?


    Thursday, November 14, 2013 8:58 AM


  • I found out how to fire up the routing service using a factory. I just inserted a factory in the SVC file and coded like this:

    public class MyFactory : ServiceHostFactory { protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) {

    // Other initialization here return new ServiceHost(serviceType, baseAddresses); } }

    This works. 

    But are there any drawbacks of doing it like this?



    Friday, November 15, 2013 1:04 PM