0

I've made a WCF Service to connect to a database and authenticate users, then I was thinking of how to host my service and IIS wasn't a good candidate in my opinion cause my service is going to be consumed by a small local network, so I figured it out to host my service on a windows service running on the server,so my question is if this pratice brings bad results related to performance or any other parameter?,this is the code for my windows service:

public partial class Service1 : ServiceBase
{
    private ServiceHost _host;
    public Service1()
    {
        InitializeComponent();
    }

    protected override void OnStart(string[] args)
    {
        _host = new ServiceHost(typeof(Cosmos.Service.Service1));
        var binding = new WSHttpBinding();
        _host.AddServiceEndpoint(typeof (IService1), binding, "http://localhost:4444");
        _host.Open();
    }
    protected override void OnStop()
    {
        _host.Close();
    }
    protected override void OnContinue()
    {
        _host.Open();
    }
    protected override void OnPause()
    {
        _host.Close();
    }
}
Daniel Conde Marin
  • 7,588
  • 4
  • 35
  • 44

1 Answers1

0

As Daniel says, there is nothing wrong with self hosting compared to hosting in IIS. See this question for more discussion: IIS WCF service hosting vs Windows Service

Community
  • 1
  • 1
Alf Kåre Lefdal
  • 643
  • 1
  • 6
  • 27