monkeyhouse
monkeyhouse

Reputation: 2896

How to use a wcf console application on server?

I've made a basic wcf console app service that communicates over pipes.net. The logic works with my main application, but I need to keep it seperate for business reasons

It does one of these

   Uri baseAddress = new Uri(@"net.pipe://localhost/Server");
   Uri baseHttpAddress = new Uri(@"http://localhost:9080");

   using (var host = new ServiceHost(typeof(CPLConversionService), baseAddress, baseHttpAddress))
   {
       host.Open();
       Console.WriteLine("The CPLConversionService is available. ");

       Console.WriteLine("Press <Enter> to stop the service. ");
       Console.ReadLine();

       host.Close();
    }

Anyway, it is okay to put this up on a web-server and let it run long term? Should I manage it using IIS instead in some form?

Upvotes: 0

Views: 191

Answers (2)

Ruslan
Ruslan

Reputation: 136

Hosting in Windows Service is better for production use for it's autostart feature. Hosting in IIS is easier and gives better maintainability and configuration. IIS with App Fabric gives better monitoring of your service.

See this answer for help with choosing a way of hosting https://stackoverflow.com/a/9823604/2898090

Upvotes: 1

Vasiliy
Vasiliy

Reputation: 492

Windows Service is better then console application. You can define start properties for service (user, auto start, dependencies and fault behavior).

Upvotes: 0

Related Questions