问题
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();
}
}
}
回答1:
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.
来源:https://stackoverflow.com/questions/13527498/asp-net-mvc-4-how-to-keep-routing-to-default-document-after-project-publishing