开发者

Asp.Net MVC2 Deploy

i try to deploy a simple mvc2 application. but it doesnt work. my hosting provider is qualityhosting.de and they support mvc.

i see开发者_StackOverflow社区 the homepage "My MVC Application - Welcome to ASP.NET MVC!" but after a click on "about" (for example) i got "The page cannot be found".

Could someone help me please?

Thank you!!


This means that the URL rewriting mechanisms are not working. You should understand what does your provider require to enable them: maybe you need to go to your control panel and enable something?


It is most likely because your hosting provider is not configured to handle extension less urls as ASP.NET pages.

For this you need to check if you can configure this with your hosting provider or as an alternative alter your routes so that you include the .aspx (which of course is configured to use ASP.NET) extension in your routes. This however makes "defaults" a little more tricky since you need to have explicit routes for all "levels", i.e.

routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = "" }
);

Becomes

routes.MapRoute(
    "MainActionId",
    "{controller}/{action}/{id}.aspx",
    new { controller = "Home" }
);

routes.MapRoute(
    "MainAction",
    "{controller}/{action}.aspx",
    new { controller = "Home" }
);

routes.MapRoute(
    "Main",
    "{controller}.aspx",
    new { controller = "Home", action = "Index" }
);


You might need to configure the IIS so that it can get the page without any extension i.e. add ".*" as extension, the following site might help http://blog.stevensanderson.com/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/ cheers!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜