Embedding a lightweight web server into a .net application (node.js)?

I have a project built with Awesomium built in .NET and it requires the use of Flash. Flash throws security errors trying to access local content (video player) and the solution(s) Awesomium offers have not been ported to the .NET wrapper yet. I'm wondering if there is a fairly straight-forward way to include a run-time web server in the application where I can just pick some arbitrary port and create a localhost server when the application runs and point my Awesomium browser there.

Any ideas?


NHttp provides an HTTP server with request parsing, but you have to roll your own responses. There's also Kayak, and the framework's own HttpListener.

Nancy is a full MVC framework, supports the ASP.NET Razor syntax, and has lots of options for configuration and extensibility. There's a self-host package available on nuget.

If you just need to serve up a SWF file and some JSON data, the first set would probably be simpler to integrate -- if you need to render full web pages, I would recommend Nancy.

Here's another alternative I wrote last year and and has served me well.

EmbedIO: https://github.com/unosquare/embedio

I use it mostly to create RESTful services on the Raspberry Pi (soft-float). Updated code for Mono 3.10, support for WebSockets, and Asynchronous handling of requests.

NuGet Package also available.

I'm guessing this is Windows.. You don't (or shouldn't) need to use a web server. If you create a cfg file, doesn't matter what it's called, in this directory:

%appdata%\Macromedia\Flash Player#Security\FlashPlayerTrust

And put a single line in it containing the path to the folder you want to trust then Flash will load local resources without security issues. You can delete the file again when you shutdown (this is what we do).

Same principal on other platforms, just the location of that FlashPlayerTrust folder is different.

For ASP.Net MVC (and other) self-hosting You can use OWIN implementations:

Open Web Interface for .NET (OWIN) defines an abstraction between .NET web servers and web applications. OWIN decouples the web application from the server, which makes OWIN ideal for self-hosting a web application in your own process, outside of IIS.

Here you can find a simple example with WebAPI.

If you need a little ASP.NET on the server side, use Mono.WebServer and Mono.WebServer.XSP. Here: https://github.com/mono/xsp/tree/master/src

Else, you can use uhttpsharp: https://github.com/raistlinthewiz/uhttpsharp

Or you can use "webserver" from codeplex: http://webserver.codeplex.com/

Or more heavyweight, Cassini: https://cassinidev.codeplex.com/

I appears as though you can play local flash content as long as the content is set to be trusted.

What is Flash Player security for local content?

Local content can be designated as trusted so that it is not interrupted by this dialog box and is allowed to function as designed. This trust must be explicitly designated in one of two ways.

  • By running a software installation program in which the content in the application you install is already registered as trusted. When you run an installation program, you are explicitly allowing a program to be installed on your computer. Thus, the publisher of the application can automatically register the content with Flash Player as trusted.

  • By adding specific content or directories to a list of trusted files, through the Global Security Settings panel in the Flash Player Settings Manager. In this panel, you can designate specific content or even directories as trusted by manually registering locations with Flash Player. For step-by-step instructions on how to designate content as trusted, see the TechNote: How do I let local Flash content communicate with the Internet?

If you would like to take advantage of HTTP2 ability to stream content efficiently, you can also use GRPC to embed an HTTP2 server.



Need Your Help

Finding the date/time a file was first added to a Git repository


Is there a simple Git command to determine the "creation date" of a file in a repository, i.e. the date it was first added?

Difference between i++ and ++i in a loop?

post-increment pre-increment

Is there a difference in ++i and i++ in a for loop? Is it simply a syntax thing?