ASP.net MVC 4,如何保持路由项目发布后,默认文档 [英] ASP.net MVC 4, How to keep routing to default document after project publishing
问题描述
我创建从互联网的应用程序模板创建一个新的MVC 4项目于2012 VS前preSS,<一个href=\"http://stackoverflow.com/questions/13511303/deploying-mvc-4-application-to-localhost-gives-http-error-404#comment18519554_13511303\">for详情请点击这里
当我想出版,我得到了: HTTP 403.14 - 禁止
我寻找一个解决方案,并发现它看起来像一个路由问题,计算器等职位通过修改MVC 3 Global.asax的指令给出答案。
当我试图相同的解决方案适用于MVC 4 Global.asax中,我发现语法不同于MVC 3的太不一样了,即。 RouteConfig.RegisterRoutes(RouteTable.Routes)
命名空间MyMVC4
{
公共类MvcApplication:System.Web.HttpApplication
{
保护无效的Application_Start()
{
AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
}
}
我的怀疑是错的,的这是为什么会发生和溶液被Dommer <提供一href=\"http://stackoverflow.com/questions/2659544/cant-run-asp-net-mvc-2-web-app-on-iis-7-5\">here,该程序是为Visual Studio 2012是相同的。
I created a new MVC 4 project from the internet application template in VS 2012 express, for details click here
When I wanted to publish it, I got: HTTP 403.14 - Forbidden
I searched for a solution, and found that it looks like a routing issue, other posts in stackoverflow give answers through modifying MVC 3 global.asax instructions.
when I tried to apply the same solution to the MVC 4 global.asax I found syntaxes too different from those of MVC 3, i.e. RouteConfig.RegisterRoutes(RouteTable.Routes)
namespace MyMVC4
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
}
}
My doubt was wrong, This is why it happens, and the solution is provided by Dommer here, The procedure is the same for Visual Studio 2012.
这篇关于ASP.net MVC 4,如何保持路由项目发布后,默认文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!