Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Mono.WebServer (XSP) to run my mono ASP MVC application?

I've have been using Mono Develop 2.8 on a to make an ASP MVC application.

The application works nicely in Mono Develop and when I 'Run' or 'Debug', from the IDE, it starts a local server to run my code.

Now I am at a point where I want to run my ASP MVC application outside of Mono Develop.

The first thing I have been trying to do it just mimic the steps Mono Develop takes to get this running.

I found the Mono.WebServer namespace and also the following article from 2005:

http://weblogs.asp.net/britchie/archive/2005/07/25/420512.aspx

documenting how to run your own XPS server.

class MainClass
{
    public static void Main (string[] args)
    {
        int Port=8080;

        string path="\\TempDeploy";

        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();
    }
}

I have tried this code and it generate a few warnings about using obsolete parts of the Mono.WebServer dll. When I run it and navigate 127.0.0.1:8080 I can see that something is running, I get 404 errors. The data in I have in the /TempDeploy folder is the result of running the Mono Develop 'Deploy To The Web' option to that directory. It contains the standard ASP MVC structure:

/TempDeploy/
    /bin/
    /Content/
    /Scripts/
    /Views/

What changes do I need to make to the above code to get it run an ASP MVC application. I assume it needs to be pointed to the dlls in the bin directory, but I don't know what calls to make to set it up properly.

Any help would be greatly appreciated.

Thanks.

like image 715
sungiant Avatar asked Jan 25 '12 09:01

sungiant


1 Answers

Just run xsp4 in the directory with your web application.

like image 93
konrad.kruczynski Avatar answered Nov 27 '22 04:11

konrad.kruczynski