简体   繁体   中英

What to create using .NET 3.5? A Web Service or a Windows Service

I have to create a Web Service that can service around 100,000 clients. I have been creating Windows Services for quite some time and use WCF binding in them. The Windows Services use HTTP binding and provide a http end point that can be used by any client that can talk using SOAP. I am a little confused whether I should create a ASP.NET Web Service or a Windows Service because both of them will provide a HTTP end point. I think before WCF came around, Web Services used to enjoy the HTTP bindings and the Windows Services were used with remoting etc.

If both provide same HTTP end point then what should be the criteria for deciding on the service type?

If you're building a high volume application that needs to service 100k clients then you should choose IIS. IIS has a lot of facilities built in to handle high loads along with enterprise features like authentication and SSL certificates. If you use a Windows Service you'll hvae to roll a lot of that yourself.

You can use WCF with either so it's a decision about which application type suits you better and it definitely sounds like IIS.

The endpoint where your services lives and WCF versus ASP.NET services are two different things. Here is a decent article on the differences between WCF & ASP.NET services. Where your endpoint is hosted is going to be important for you since you are looking for high scalability. You should leverage all the great stuff built into IIS7 in terms of scalability and reliability to host your endpoint. I don't see a good reason to host it in your own process. It will be a lot of work to develop something that can scale horizontally as easily as IIS7. Here is a small article on how to host a WCF service in IIS.

You should combine all the answers.

WCF services can be hosted as both a Windows Service, as well as in IIS. IIS provides you with much more tools to scale and handle large number of requests. Since you are targeting the web, and have IIS available go and use IIS.

JP's answer contains a link on how to host WCF in IIS, that should clear up the question you had in sipwiz's answer.

So go on and create a ASP.NET web app. And in there create a WCF service (or add a WCF service library project to your solution, and reference that in your ASP.NET web app.

Given the scale of what you're doing, you might want to stick with WCF. The ease of configuring different protocols and other framework features such as built in logging should serve you well.

One advantage of using an asmx service is that it's easy to integrate into a web site project. If you're on a small scale site with shared hosting, you might not be able to run a WCF service, but you will be able to run an asmx service.

You should definitively think about scalability here. For example: what happens if your system has to be scaled up using a Web farm? How does the Win service scenario fit into that situation?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM