开发者

When should we host WCF service in IIS and when should we host in a windows service?

I need to host my WCF service but I am unable to decide whether I should host it 开发者_JS百科in IIS or a windows service?

What are the advantages, drawbacks, benefits of one over the other please?

Thank you


IIS under version 7 is out of the question for any serious hosting anyway....

As for IIS7+/WAS vs. self-hosting in a NT service:

  • the IIS7/WAS setup will "load on demand", e.g. when your first request comes in, a ServiceHost will be created, then that service host creates the service class to handle the request. This is beneficial from a memory point of view (uses no memory for the ServiceHost if no requests come in), but it's a bit of an additional overhead on the first call when IIS first needs to spin up the service host

  • NT Service allows you to pre-create the ServiceHost and open it so it's ready to handle requests right away; a bit more memory usage, but a bit more responsive, at least on "first calls"

Another benefit of self-hosting: you're 100% in charge of when the service host starts, pauses, stops, and so on. With IIS/WAS, you're at times at the mercy of IIS with its potential to recycle app pools at the worst possible moment......


The main advantages of IIS is that it handles the lifetime of your service for you: activation, recycling...

Its main drawback if you don't have v7 is that without WAS it can only host http based web services

The services need more care in case of fatal error... and then need to be installed whereas a web site can be copied to its web folder once it has been created

If your version of iis is >= 7, then I don't see a lot of interest in not using WAS as it supports all the wcf transports, others might have a different view though...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜