如何使用 Mono.WebServer (XSP) 运行我的 mono ASP MVC 应用程序?

发布于 2024-12-28 15:12:33 字数 1470 浏览 3 评论 0原文

我一直在使用 Mono Develop 2.8 来制作 ASP MVC 应用程序。

该应用程序在 Mono Develop 中运行良好,当我从 IDE 中“运行”或“调试”时,它会启动本地服务器来运行我的代码。

现在我想在 Mono Develop 之外运行 ASP MVC 应用程序。

我尝试做的第一件事就是模仿 Mono Develop 运行它所采取的步骤。

我找到了 Mono.WebServer 命名空间以及 2005 年的以下文章:

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

记录如何运行您自己的XPS 服务器。

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

我已经尝试过这段代码,它生成了一些关于使用 Mono.WebServer dll 过时部分的警告。当我运行它并导航 127.0.0.1:8080 时,我可以看到某些东西正在运行,但出现 404 错误。我在 /TempDeploy 文件夹中的数据是对该目录运行 Mono Develop“部署到 Web”选项的结果。它包含标准 ASP MVC 结构:

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

我需要对上述代码进行哪些更改才能使其运行 ASP MVC 应用程序。我认为它需要指向 bin 目录中的 dll,但我不知道要进行哪些调用才能正确设置它。

任何帮助将不胜感激。

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

虚拟世界 2025-01-04 15:12:33

只需在 Web 应用程序的目录中运行 xsp4 即可。

Just run xsp4 in the directory with your web application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文