ASP.NET MVC:默认页面的工作,但其他页面返回404错误 [英] ASP.NET MVC: Default page works, but other pages return 404 error
问题描述
我创建了一个Hello World应用,在同样的 http://giantflyingsaucer.com /博客/?p = 409 。它完美的作品我开发计算机上,使用内置的Web服务器。
I created a "Hello World" application, in the same vein as http://giantflyingsaucer.com/blog/?p=409. It works perfectly on my development computer, using the built-in web server.
我跟着菲尔哈克的建议在的 http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx 。我用的发布功能得到一个输出目录,并复制所有文件上的ISP(网络解决方案)的正确的地方。
I followed Phil Haack's advice for doing a Bin Deployment at http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx. I used the Publish feature to get an output directory, and copied all of the files to the correct places on the ISP (Network Solutions).
当我去到现场,我得到的欢迎页面,但是当我做的http:// MYDOMAIN /你好,我得到一个404错误
When I go to the site, I get the welcome page, but when I do http://mydomain/hello, I get a 404 error.
这可能是什么问题?
下面是该修补程序。显然,网络解决方案运行IIS6毕竟。我得到了我从需要什么http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/ 。新的路由
Here is the fix. Apparently Network Solutions is running IIS6 after all. I got what I needed from http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/. The new routing is
{controller}.aspx/{action}/{id}
注意控制占位符后,除了在.aspx的。 IIS6需要这个,因为它总是认为它正在一个实际的网页,而不是一个控制器。
Notice the addition of the .aspx after the controller placeholder. IIS6 needs this because it always thinks it is talking to an actual web page instead of a controller.
我不热衷于在URL中多余的字符,但我可能要忍受它。
I'm not keen on the extra characters in the url, but I may have to live with it.
推荐答案
您确保将其部署到IIS7服务器?如果服务器运行IIS6检查这和这帖子。
Are you sure you deployed it to an IIS7 server? If the server runs IIS6 check this and this post.
这篇关于ASP.NET MVC:默认页面的工作,但其他页面返回404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!