Partager via


Create your own asp.net hosting server with System.Net.HttpListener

.Net frameworks 2.0 contain HttpListener class under System.Net namespace and a number of ASP.Net hosting classes under System.Web.Hosting namespace.

HttpListener class is implemented on top of low level protocol stack http.sys, probably you also know that IIS 6.0 is also architected on top of http.sys. So user of HttpListener class could get advantage of many of the http.sys. System.Web.Hosting namespace is providing the classes to create and handle the ASP.Net hosting envoronment. In combination of both these features you could create your own hosting environment to handle aspx, asmx pages without using the IIS.

I was initially planning to put here some real code sample for simple host application. But looking at recent MSDN magazine, I found Aaron Skonnard has already done a great job in the article Run ASMX Without IISwith complete source code. So for code samples and more details I would recommend to read this MSDN article.

This posting is provided "AS IS" with no warranties, and confers no rights

Comments

  • Anonymous
    December 04, 2004
    ebtaw
  • Anonymous
    December 12, 2004
    This is something I'm really excited about.

    Can I create an HttpListener even if IIS is running so long as I make my listener unique (by host header or TCP Port, for instance)? If so, how will IIS behave if someone tries to create a new site with my host header name or TCP Port?

    Hey, I really like your blog. Keep posting!
  • Anonymous
    December 13, 2004
    You could register uri prefix for the same port where IIS is listening. You should be registering Uriprefixes different than what IIS is already listening for.

    Look at following msdn documentation on Prefix string to get more clarification.
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/http/http/urlprefix_strings.asp