Embedding XSP (Mono.WebServer) in your application

First off, I've contributed some code to the Mono guys to make XSP its own library.  You can get it as part of the 1.1.8 release.  I'm still working on getting a few more additions to the library, but it has all of the basics to get you going.

Download the install from http://www.mono-project.com/Downloads and get the Mono.WebServer.dll in the Mono-1.1.8\lib\mono\1.0 directory.

With that in mind, here's some code:

            int Port=8080;
            string path="\\XSPSamples";
            XSPWebSource websource=new XSPWebSource(IPAddress.Any,Port);
            ApplicationServer WebAppServer=new ApplicationServer(websource);
            //"[[hostname:]port:]VPath:realpath"
            string cmdLine=Port+":/:"+path;
            WebAppServer.AddApplicationsFromCommandLine(cmdLine);
            WebAppServer.Start(true);
            Console.WriteLine("Mono.WebServer running. Press enter to exit...");
            Console.ReadLine();
            WebAppServer.Stop();


The path should point at your ASP.NET files. That should do it...Enjoy!

NOTE: The API is probably not 100% stable, so you might need to "tweak" your application when a new Mono release comes out.

1 Comment

  • Very cool Brian!



    Hey do you know if your Mono Application Server is public knowledge or supported by the mono guys at all? The reason I ask as I see .NET application server as a missing piece in the .NET market. All we have is IIS and that keeps us on winders.



    How complete is the project?

Comments have been disabled for this content.