The reason is that my asp.net MVC3 project does not have a home page, and the default document index.asp the IIS settings does not take effect.
asp.net MVC3 website Settings first page is HTML or ASP file
Open Global.asax, add the following code to resolve:
| The code is as follows |
Copy Code |
|
protected void Application_BeginRequest (object sender, EventArgs e)
{
if (Context.Request.FilePath = = "/") Context.rewritepath ("index.asp");
} |
Later on the internet also found a number of ways to share the following two a good
Creates a new routing Defaultcontroller and sets it as the default route, increasing in action
Redirect (Url.content ("~/index.html"));
This method needs to modify the Web.config configuration
Increase in the <compilation> node in the Web.config file:
| code is as follows |
copy code |
|
< Buildproviders>
<add extension= ". htm" type= "System.Web.Compilation.PageBuildProvider"/>
</buildproviders> |