none
ASMX vs. WCF

    Question

  • Here is an article I read about this: http://geekswithblogs.net/khanna/archive/2006/01/06/65067.aspx
    Do you know any other resources on this subject?

    My question is.... what do I get if I convert my current web services that run under IIS into WCF services hosted under a windows service.
    Apparently I make my system independed of IIS. This is good. But some people may prefer having IIS as the application server instead of my custom windows service. What answer should I give?
    Wednesday, March 07, 2007 10:26 PM

Answers

  • So the question is:  What are the advantages of IIS hosting vs Windows service hosting.  

    - IIS gives you a much richer hosting environment than a Service does.  This includes reliability features such as AppDomain recycling, worker process recycling.  It includes better managability.  A great deal of work has gone into making IIS hosted apps scalable.  It's a good choice for larger scale or high volume apps.

    - From a hosting prespective, a service essentially a regular exe that can be started and stopped by the Service Control Manager.  This makes it more managable than a regular exe but does not give it any additional hosting features.  It's as easy to configure as a regular exe and easy to deploy.  It can also run as the local system account if that's necessary. 

    Wednesday, March 07, 2007 11:45 PM

All replies

  • So the question is:  What are the advantages of IIS hosting vs Windows service hosting.  

    - IIS gives you a much richer hosting environment than a Service does.  This includes reliability features such as AppDomain recycling, worker process recycling.  It includes better managability.  A great deal of work has gone into making IIS hosted apps scalable.  It's a good choice for larger scale or high volume apps.

    - From a hosting prespective, a service essentially a regular exe that can be started and stopped by the Service Control Manager.  This makes it more managable than a regular exe but does not give it any additional hosting features.  It's as easy to configure as a regular exe and easy to deploy.  It can also run as the local system account if that's necessary. 

    Wednesday, March 07, 2007 11:45 PM
  •  Martin Petersen-Frey - MSFT wrote:

    IIS gives you a much richer hosting environment than a Service does.  This includes reliability features such as AppDomain recycling, worker process recycling.  It includes better managability.  A great deal of work has gone into making IIS hosted apps scalable.  It's a good choice for larger scale or high volume apps.

    There isn't alwas a clear and single anwser to such a question, but some of these features may be considered a disadvantage for some application types. For instance AppDomain recycling can be considered as an instability since you cannot always control when it is done.

    What do you mean by better managability?

    Thursday, March 08, 2007 7:43 AM
  • I want to ask a clarifying question as your subject contradicts the topic in your message: why are you asking?  Your subject and message seems to imply that you can't host WCF in IIS, which you absolutely can do.
    Monday, March 12, 2007 7:33 PM
  • This is true. My question was not set right. Actually Martin rephrased my question to this one, which it is what I wanted to ask in the first place:

    IIS hosting vs Windows service hosting

    Monday, March 12, 2007 8:36 PM
  • By better managability, I mean you have all the IIS features and the features of other products at your disposal to help you manage and scale out an IIS app.
    Monday, March 12, 2007 9:20 PM
  • It is true that AppDomain recycling isn't always a good thing, it will kill sessionfull connections for example and any app state, although you can turn it off.
    Monday, March 12, 2007 9:22 PM
  • I realize the post is dated, but a word of advice for people that happen to read it...

    IIS was really designed to host web pages, not web services. Even then, WCF services can be run under IIS. So you can convert existing ASMX to WCF and still host them under IIS. It's a possibility but not ideal.

    Windows services were really designed to host local machine background services, not web services. WCF services can run there, but again it is not ideal.

    If both options are not ideal, then what is?

    Under Windows Server 2008, WCF services should be hosted under WAS. That is the only host designed from the ground up for web services.

    Unless you take the WAS road in the future, or you benefit from WCF specific features, I would simply advise against converting your ASMX to WCF.


    Monday, November 19, 2007 4:38 PM
  • I would say that while IIS was originally designed to host Web Sites it has evolved substantially over the years and is now a capable application hosting service with a lot of attention paid to reliability and up time.    Any HTTP request/reply communications oriented app is very well suited to being hosted in IIS and that includes ASMX and WCF with HTTP Bindings.

     

    Session has always been an issue with Web servers which prefer to be as stateless as possible.   There must be work arounds for Web sites that move state/session management off the Web Server if the Web server is configured to recycle.   State for sessionful connections must be managed locally so that is the only caveat to using WCF with IIS.   Process recycling would need to be turned off since you'd loose communications sessions with a new process.  

     

    When selecting a hosting solution, consider what the needs of the app are and make a choice that suites those needs.   If you need sessionful communications, you need to take that into account when selecting/configuring a host.   Needless to say the hosting story for WCF is evolving and Win Server 2008 is indeed the next step.

    Tuesday, November 20, 2007 8:10 PM