问题
I am trying to upload an ASP.NET MVC application in a shared server running on IIS 6 and Windows 2003. I don't have access to IIS. I've changed the global.asax.cs
file as follows:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}.aspx/{action}/{id}",
new { action = "Index", id = "" }
);
routes.MapRoute(
"Root",
"",
new { controller = "Home", action = "Index", id = "" }
);
It is working fine, but it doesn't drop the .aspx
at the end of the controller. Is there a way to remove the .aspx
extension in the URL?
回答1:
As far as I know you're URI's should work off the bat providing you are on IIS7.
If you are on IIS6 however you will need to jump through some hoops to get extensionless URI's.
This guide may help - haacked.
As far as I can tell though you'll need access to handler mappings in IIS6, which you probably won't have on your shared host.
回答2:
No, it's because your host has not set IIS to send all requests through ASP.NET. The only thing you can do is to ask your host to change this setting.
回答3:
Change the host. Seriously. Shared hosting STILL using IIS 6 - that is brutal. Hosts should have switched over quite some time ago.
来源:https://stackoverflow.com/questions/2446907/how-to-deploy-asp-net-mvc-application-in-a-shared-hosting-without-losing-the-bea