views:

521

answers:

3

I'm looking for a small and fast library implementing an HTTP server in .NET

My general requirements are:

  • Supports multiple simultaneous connections
  • Only needs to support static content (no server side processing)
  • HTTP only, HTTPS not needed
  • Preferably be able to serve a page from an in memory source. I want to integrate it into another app to be able to make changing data available via a browser, but I don't want to have to write it to a file on disk first. For example, just pass it a C# string to use as the current page content.
  • Preferably open source so I can modify it if needed
  • Definitely needs to be free... it's for a personal project with no budget other than my own time. I also want to be able to release the final product that would use this library freely (even if that means complying to the particular OSS license of that library.

Edit: To clarify some more, what I need can be REALLY simple. I need to be able to serve essentially 2 documents, which I would like to be served directly from memory. And that's it. Yes, I could write my own, but I wanted to make sure I wasn't doing something that was already available.

+6  A: 

Use Cassini.

Free, Open Source.

It would take trivial hacking to serve from memory.

FlySwat
+3  A: 

Well, how complicated of a HTTP server do you need? .NET 2.0 has the HttpListener Class which you can use to roll your own basic library. Since this is for a personal project and you are willing to invest the time, it would also make for a good learning experience as you you would get to learn how to work with the class. Additionally, according to the MSDN documentation, it has an asynchronous mode that gives each request its own thread.

Getting a basic HTTP server with the class up and running isn't too difficult either, you should be able to get it done in only a couple hundred lines of code.

Rob
+1  A: 

Check out Kayak.

Avi Flax