How can I create a simple webserver

Sep 4, 2012 at 11:33 PM

I have a website (html, js, css, etc) and would like to use this to serve them back. I can't seem to find an example of that. Basically I do not want use IIS but host 'IIS' in my own C# windows service.

 

thx

Ralph

Oct 23, 2012 at 12:20 PM

You need to use a static FileModule and add it to your server, in my case I am using the MVCServer and resources embedded in my exe. 

 

 

_server = new MvcServer();

// Add static file handler
var module = new FileModule();
module.Resources.Add(new EmbeddedResourceLoader("/", Assembly.GetExecutingAssembly(), "Namespace.Resources"));
_server.Add(module);

 

Create a folder called Resources and make the Build Action "Embedded Resource". Replace the Namespace above with your own.