1

I have a class in framework that I need to self host WCF service like this:

class ServiceMonitor
{
   private static ServiceHost _host;

   public static void Monitor()
   {
      _host = new ServiceHost(typeof(ICacheChangeSubscriber));
      _host.AddServiceEndpoint(typeof(ICacheChangeSubscriber), new BasicHttpBinding(), "http://localhost/Service");
      _host.Open();
   }
}

This class will be used both in ASP.NET application and windows service, my question is does this code working both in ASP.NET scenario and windows service scenario? I guess it will work in windows service, how about ASP.NET? would it have any issues?

  • Yes it will work with asp.net. Just go through with some results like how to consume and use WCF in asp.net,you will get better idea. – siddhesh Sep 30 '13 at 07:54
  • IIS is hosting the WCF, not a class. It's totally possible, see [this](http://stackoverflow.com/q/10374131/447356) for details. :) – Shadow The GPT Wizard Sep 30 '13 at 07:55

0 Answers0