开发者

Hosting of WCF and Windows Services

My head hurts so much I think I need a bottle of aspirin...

I've created a WCF service and, with help of others from this site and the department I work in, the WCF service is running as a service on my development machine. Tested it with a console app and it works.

But, it's not supposed to be on my development machine. It needs to be on a different server.

This is difficult because the serv开发者_开发知识库er it is supposed to reside on DOES NOT have Visual Studio installed on it.

So I cannot run the VS 2008 Command Prompt with installutil to run the WCF service as a service on that server.


Broadly speaking, you've got three options, all of which are described on MSDN:

  • Host the service under IIS
  • Self-host the service in any managed .NET application
  • Host the WCF service under a Windows Service

Which one is right for you depends on what your service is for, how it'll be consumed, how scalable and secure you need the set-up to be, and a dozen other things besides. Without knowing a bit more about what your service does and how it'll be used in your organisation, it's difficult to make a recommendation.

IIS hosting is easy to set up and is the way to go if you want to leverage all of the industrial-strength hosting functionality that a full-blown web server offers.

Self-hosting is quick and easy - you can knock out a WCF-hosting console app in two minutes flat - but is the clunky solution. You of course have to run the host application as a particular Windows user. Perhaps not ideal?

Hosting under a Windows service is the middle ground. It gives you that always-available functionality without having to be logged in as a specific user, but doesn't offer the configurability and scalability of the IIS solution. It takes a bit more effort than belting out a quick console app, but not much.


The server that the windows service will reside on will have the .NET Framework. INSTALLUTIL is located in the Microsoft.NET\Framework(version number) folder in the Windows directory.

For example, C:\Windows\Microsoft.NET\Framework\v2.0.50727.

No need to write a console app to host your service now (unless you want to).


You can also host your WCF service under IIS, check this out: MSDN - How to: Host a WCF Service in IIS. It really is just a five minute job :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜