Stu*_*art 19 asp.net iis asp.net-mvc iis-7 httphandler
我有一个用Cassini开发和测试的mvc应用程序.在GoDaddy上部署到我的网站,默认页面就可以了.点击登录,我得到404.
我在IIS 7下运行,所以这是出乎意料的.我的路线很简单:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Public", action = "Index", id = "" }
);
routes.MapRoute(
"Report1",
"Report/{action}/{start}/{end}",
new { controller = "Report", action = "Index" }
);
routes.MapRoute(
"Report2",
"Report/{action}/{start}/{end}/{idList}",
new { controller = "Report", action = "Index" }
);
Run Code Online (Sandbox Code Playgroud)
知道可能会发生什么或我如何解决这个问题?
Meh*_*ari 29
你在IIS7 集成模式下运行吗?
IIS7的经典模式不会自动将无扩展名的URL映射到ASP.NET(很像IIS6).
还要确保您的Web.config <system.webServer>标记配置正确.
Chr*_*ing 23
不要使用runAllManagedModulesForAllRequests.您希望让IIS处理图像等资源.
<system.webServer> <!-- Rather do NOT use this -->
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
而是添加MVC路由模块
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
小智 14
尝试了一切,我必须像这样设置我的网络配置,以使其工作.
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
46716 次 |
| 最近记录: |