在 MVC 网站上出现 404 错误 [英] Getting 404 error on MVC web-site

查看:41
本文介绍了在 MVC 网站上出现 404 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows Server 2008 上有一个 IIS7.5 网站,其中部署了一个 ASP.NET MVC2 网站.该网站是在 Visual Studio 2008 中构建的,面向 .NET 3.5,并且 IIS 5.1 已成功配置为运行它,用于本地测试.

I have an IIS7.5 web-site, on Windows Server 2008, with an ASP.NET MVC2 web-site deployed to it. The website was built in Visual Studio 2008, targeting .NET 3.5, and IIS 5.1 has been successfully configured to run it as well, for local testing.

但是,每当我尝试导航到在 IIS7 中运行的页面时,都会收到 404 错误.

However, whenever I try and navigate to a page running in IIS7, I get a 404 error.

我检查了以下几点:

  • IIS 日志中没有对应的 404 日志条目.
    • 实际上,在 IIS 日志中有 404 个条目.
    • There is no corresponding 404 log entry in IIS logs.
      • Actually, there are 404 entries in the IIS log.

      编辑好的,所以我们已经安装了世界上最简单的 MVC 应用程序(当您在 Visual Studio 中创建一个新的 MVC2 项目时创建的那个),我们仍然在我们尝试访问的任何页面上得到 404 - 例如.<my_server>/Home/About 将生成 404.

      EDIT Ok, so we've installed the world's simplest MVC application (the one which is created when you create a new MVC2 project in Visual Studio), and we are still getting 404s on any page we try and access - e.g. <my_server>/Home/About will generate a 404.

      任何想法将不胜感激!

      推荐答案

      我们最终通过导出工作服务器的 IIS 配置并与我们的比较来解决这个问题.

      We finally nailed this issue by exporting the IIS configuration of a working server, and comparing it to ours.

      这是一个非常晦涩的设置,已从默认设置中更改.

      It was a really obscure setting which had been changed from the default.

      IIS 根目录 →请求过滤 →文件扩展名选项卡 →编辑功能设置 →允许未列出的文件扩展名

      IIS ROOT → request Filtering → Filename Extensions Tab → Edit Feature Settings → Allow unlisted file name extensions

      这应该打勾.

      这可以在 IIS 级别或站点级别设置.

      This can be set at the IIS level, or the site-level.

      这篇关于在 MVC 网站上出现 404 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆