Aug 25, 2011 at 10:52 PM
Edited Aug 25, 2011 at 11:11 PM
Here's my steps (I'm using VS2010).
- Download the solution from source, convert to VS2010, build in debug mode, so I have the dll available
- Create a separate, new command line project in VS2010
- Copy Main() from \Samples\HttpServer\WebServer to my Program.cs Main() class
- Add in a line to set MaxContentSize to fix a bug where no default is set (only appear to need this line for the POST)
- Create new folder in my project called 'dlls'
- Copy \HttpServer\bin\Debug\HttpServer.dll to a new folder in my project
- Add reference to HttpServer.dll from my dlls folder
- Create new wwwroot folder, and put the sample web page and associated files in there
- Change the path in the new FileResources line to match my wwwroot folder
- Build my project. All is OK
- Run my project (Debug mode). All is OK
- Set breakpoint on 1st line ofOnRequest() method
- In a browser, request machinename:8085
- Sample page shows in browser before the breakpoint is hit!
- Breakpoint only stops when the browser (IE9) requests favicon.ico
I'm stumped! This is a really simple demo and it doesn't work as I assume it is intended. Maybe I've completely missed the point of this sample, but if so, then the samples and documentation need to be clearer.
UPDATE: I've rebuilt, and cleared the cached, and the browser is no longer requesting favicon. I have once had the OnRequest() method stop at the breakpoint, but only after a POST, never on the initial GETs. Often after the POST I get a 500 error, Request.cs:line
244 Object reference not set to an instance of an object.