I'm trying to setup the MVC development enviroment on my laptop. I'm running WinXP Pro with IIS 5.1
我正试图在我的笔记本电脑上设置MVC开发环境。我正在使用IIS 5.1运行WinXP Pro
I got the environment setup with the sample MVC application that come with beta. I can only get to the home page. when i try to open About us page. i run into the page can not be found error. Is it the routing not set in the Global.asax?
我使用beta版附带的示例MVC应用程序进行了环境设置。我只能到主页。当我尝试打开关于我们的页面。我跑进页面无法找到错误。它是否未在Global.asax中设置路由?
4 个解决方案
#1
Your issue is that IIS 5/6 don't play nice with routes without extensions, the home page is resolving because its pointing to default.aspx,
你的问题是IIS 5/6对没有扩展的路由不好看,主页正在解析,因为它指向default.aspx,
In a nutshell, do this:
简而言之,这样做:
If *.mvc extension is not registered to the hosting , it will give 404 exception. The working way of hosting MVC apps in that case is to modify global.asax routing caluse in the following way.
如果* .mvc扩展名未注册到主机,则会给出404异常。在这种情况下托管MVC应用程序的工作方式是以下列方式修改global.asax路由caluse。
routes.Add(new Route("{controller}.mvc.aspx/{action}", new MvcRouteHandler()) { Defaults = new RouteValueDictionary (new{ controller = "YourController"} ) });
In this way all your controller request will end up in *.mvc.aspx, which is recognized by your hosting. And as the MVC dlls are copied into your local bin , no special setttings need to be done for it.
通过这种方式,您的所有控制器请求都将以* .mvc.aspx结尾,该主机可识别该请求。并且当MVC dll被复制到您的本地bin中时,不需要为它进行特殊设置。
See this question for lots of good information:
有关很多好消息,请参阅此问题:
ASP.NET MVC和IIS 5
#2
You can give a look at this article that may help you: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
你可以看看这篇可能对你有帮助的文章:http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
#3
You may go to your IIS site's properties, tab "Home directory", press "Configuration...", select ".aspx", press "Insert...", Type "c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll", uncheck check box and press "Ok". This heplped me.
您可以转到IIS站点的属性,选项卡“主目录”,按“配置...”,选择“.aspx”,按“插入...”,键入“c:\ windows \ microsoft.net \ framework \ v2.0.50727 \ aspnet_isapi.dll“,取消选中复选框并按”确定“。这让我心烦意乱。
#4
Url rewriting can help you to solve the problem. I've implemented solution allowing to deploy MVC application at any IIS version even when virtual hosting is used. http://www.codeproject.com/KB/aspnet/iis-aspnet-url-rewriting.aspx
Url重写可以帮助您解决问题。我已经实现了允许在任何IIS版本上部署MVC应用程序的解决方案,即使使用虚拟主机也是如此。 http://www.codeproject.com/KB/aspnet/iis-aspnet-url-rewriting.aspx
#1
Your issue is that IIS 5/6 don't play nice with routes without extensions, the home page is resolving because its pointing to default.aspx,
你的问题是IIS 5/6对没有扩展的路由不好看,主页正在解析,因为它指向default.aspx,
In a nutshell, do this:
简而言之,这样做:
If *.mvc extension is not registered to the hosting , it will give 404 exception. The working way of hosting MVC apps in that case is to modify global.asax routing caluse in the following way.
如果* .mvc扩展名未注册到主机,则会给出404异常。在这种情况下托管MVC应用程序的工作方式是以下列方式修改global.asax路由caluse。
routes.Add(new Route("{controller}.mvc.aspx/{action}", new MvcRouteHandler()) { Defaults = new RouteValueDictionary (new{ controller = "YourController"} ) });
In this way all your controller request will end up in *.mvc.aspx, which is recognized by your hosting. And as the MVC dlls are copied into your local bin , no special setttings need to be done for it.
通过这种方式,您的所有控制器请求都将以* .mvc.aspx结尾,该主机可识别该请求。并且当MVC dll被复制到您的本地bin中时,不需要为它进行特殊设置。
See this question for lots of good information:
有关很多好消息,请参阅此问题:
ASP.NET MVC和IIS 5
#2
You can give a look at this article that may help you: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
你可以看看这篇可能对你有帮助的文章:http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
#3
You may go to your IIS site's properties, tab "Home directory", press "Configuration...", select ".aspx", press "Insert...", Type "c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll", uncheck check box and press "Ok". This heplped me.
您可以转到IIS站点的属性,选项卡“主目录”,按“配置...”,选择“.aspx”,按“插入...”,键入“c:\ windows \ microsoft.net \ framework \ v2.0.50727 \ aspnet_isapi.dll“,取消选中复选框并按”确定“。这让我心烦意乱。
#4
Url rewriting can help you to solve the problem. I've implemented solution allowing to deploy MVC application at any IIS version even when virtual hosting is used. http://www.codeproject.com/KB/aspnet/iis-aspnet-url-rewriting.aspx
Url重写可以帮助您解决问题。我已经实现了允许在任何IIS版本上部署MVC应用程序的解决方案,即使使用虚拟主机也是如此。 http://www.codeproject.com/KB/aspnet/iis-aspnet-url-rewriting.aspx