sensaura-public / iotweb

A simple HTTP and WebSocket server component for Windows 10 IoT Core and .NET 4.5
38 stars 21 forks source link

A sample #3

Open ghost opened 8 years ago

ghost commented 8 years ago

I think you should add samples for UWP and Desktop , or just Wiki . They are easy to understand.

sensaura-public commented 8 years ago

A WiKi implementation for UWP and Desktop is a good idea, thanks. Now it's just a matter of finding the time :(

ghost commented 8 years ago

Ah , I am always busy , too :(

ghost commented 8 years ago

Well , I have a question . How can I use AddHttpRequestHandler in UWP ? I tried to put my html files into /Site and server.AddHttpRequestHandler( "/", new HttpResourceHandler( Utilities.GetContainingAssembly(typeof(Program)), "Site", "index.html" ) ); but it doesn't work , why?

sensaura-public commented 8 years ago

Steve - have you set the build action on the HTML files as 'Embedded Resource'? They need to be bundled into the final assembly or you will simply get 404 errors.

dotMorten commented 7 years ago

You should not use Embedded Resource if you can avoid it. It increases memory consumption and load time (since the entire assembly and its resources must be loaded and parsed). The best thing to use is 'content', but I'm not clear if this webserver supports that (if not, it would be quick to fix this, as reading content files are pretty straightforward)