【问题标题】:Web Forms Url Routing in MonoMono 中的 Web 表单 URL 路由
【发布时间】:2016-01-05 22:46:25
【问题描述】:

我是mono 的新手,正在尝试使用路由运行一个简单的hello world 应用程序。虽然我的应用程序在 IIS 上运行良好,但当我浏览到站点的根目录时出现 404 错误。我的路线映射如下:

RouteTable.Routes.MapPageRoute("default", String.Empty, "~/site/home.aspx")

直接浏览文件 (http://myhostname/site/home.aspx) 有效。

我尝试使用以下web.config -- 有和没有system.webServer 部分:

<configuration>
<system.web>
  <compilation strict="false" explicit="true" targetFramework="4.0" />
  <customErrors mode="Off"/>
</system.web>
<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
    <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </modules>
  <handlers>
    <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </handlers>
  <validation validateIntegratedModeConfiguration="false" />
</system.webServer>

我将nginxfastcgi-mono-server4 一起使用,我的fastcgi_index 设置为Default.aspx(我尝试过小写以及Index.aspx)。

我在这里遗漏了什么或者单声道只支持使用 MVC 的路由?

【问题讨论】:

    标签: asp.net vb.net nginx mono


    【解决方案1】:

    原来是nginx 配置问题。我没有在我的网站配置中指定root

    server {
       listen 80;
    
       location / {
         root /var/www/comparebetween/;
         fastcgi_index /;
         fastcgi_pass 127.0.0.1:9000;
         include /etc/nginx/fastcgi_params;
      }
    }
    

    我看到大多数博客通过将fastcgi_index 设置为Default.aspx 并指定fastcgi_passfastcgi_params 来建议最低配置,但我希望以上内容对遇到同样问题的人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多