Use HttpListener for production web server caliber?

Is it realistic to use the C # .Net class of the HttpListener as the basis for the production caliber of the web server?

The http web service I need for the host does not contain .aspx or static files. All HTTP responses are dynamic and generated in C # code that is invoked through several switch statements that check for a quiet URL format.

My thinking is that IIS is actually a user-mode shell around the Windows-OS / s kernel module for Windows o / s, which does all the work under heavy load, as well as the HttpListener.

I already have a basic multi-threaded web server which is great for development because it runs in debug mode on the instance, now I think I need IIS overflow for production. Low memory is another attraction.

+7
c # webserver
source share
4 answers

You have two serious choices. And no, encoding your own web server using HttpListener is not a production class.

1) Use IIS. It has many features for security, performance, and, more importantly, manageability that you have to invent yourself. Like remote administration, logging, integrated Windows security, etc.

2) Use WCF and create a ServiceHost to host your files. Then you will have to implement your own services and find a way to manage your life. You can do this, but then again, if you're talking about RESTFul web calls, IIS really does.

Avoid manually moving your own. Over the past 10 years, IIS has changed a lot. This is by no means a large monolithic server. They are modularized in almost everything, especially in Windows 2008, so you get a lean and fast system.

+6
source

Well, as said, try using IIS first.

HttpListener is not bad at all - it is the fastest managed listener server you can have now (faster than TcpListener and faster than the Socket class). And this is actually the same as with IIS. But IIS has a lot more.

I can’t say that IIS is the use of monolithic hosting, which showed that Win2008 has become worse in terms of stability and management. But your manual decision could be much worse. And don't forget, http.sys is much more customizable than HttpListener. That is, you cannot do streams using HttpListener, but you can do it using http.sys - Question about streaming HttpListener

But if you have enough power as a developer, you can try to write your own http.sys shell, and this is the best approach to writing your own web server in Windows.

+6
source

Garbage, turn your own. Architecture allows this. Keep in mind that there are some strange behaviors in the class. Closing it a couple of times in the NT service, he makes it scaly, like a bag of puff pastries.

If you run it on the console, no problem at all, run it async, and everything should be fine, however, start and stop the damn thing. this is another problem that I am currently struggling with, as bugs from leakproof classes are sealed by Microsoft.

I feel like python comes with a little dash cherryPy

+3
source

If you write it, you will have to support it. Microsoft has already written a web server - you should use it.

+2
source

All Articles