IIS 7 中的 ASP MVC 导致:HTTP 错误 403.14 - 禁止 [英] ASP MVC in IIS 7 results in: HTTP Error 403.14 - Forbidden

查看:29
本文介绍了IIS 7 中的 ASP MVC 导致:HTTP 错误 403.14 - 禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 ASP MVC Web 项目.现在我有一个要求,它迫使我在开发过程中部署到 IIS7(检查一些功能).每当我尝试键入网站的 URL 时,都会收到上述错误消息.(注:开发机:Vista Home Premium、IIS7)

I'm developing an ASP MVC web project. Now I have a requirement which forces me to deploy to an IIS7 inmiddle of development (to check some features). I'm getting the above mentioned error message whenever I try to type the URL of the web site. (Note: development machine: Vista Home Premium, IIS7)

到目前为止我所做的:

编辑了 HOSTS 文件 (C:WINDOWSsystem32driversetchosts).

Edited the HOSTS file (C:WINDOWSsystem32driversetchosts).

在其中放入两个域(127.0.0.1 domain1.com & 127.0.0.1 domain2.com).

Put two domains in it (127.0.0.1 domain1.com & 127.0.0.1 domain2.com).

创建一个文件夹 c:websitesdirOfApplication 并从 Visual Studio 8 中部署到此文件夹.

Created a folder c:websitesdirOfApplication and deployed from within Visual Studio 8 to this folder.

在 IIS7 中创建了一个新站点,主机名 domain1.com 和应用程序文件夹如上.

In IIS7 created a new site with host name domain1.com and application folder the above.

在 Web 浏览器中键入地址 domain1.com 导致上述错误(HTTP 错误 403.14 - 禁止 - Web 服务器配置为不列出此目录的内容.)

Typing the address domain1.com in Web browser results in the above error (HTTP Error 403.14 - Forbidden - The Web server is configured to not list the contents of this directory.)

我想我错过了一些东西,但不知道是什么!尝试部署文件 System.Web.Mvc、System.Web.Abstraction &System.Web.Routing 也有同样的结果.每当我尝试按 F5 并运行应用程序时,它都能正常工作!

I think I'm missing something but don't know what! Tryed to deploy the files System.Web.Mvc, System.Web.Abstraction & System.Web.Routing wit the same outcome. Whenever I try to hit F5 and run the application, it works fine!

推荐答案

也许对某人有用:在使用 .NET framework 4.5 将我的应用程序转换为 MVC 4 并使用 IIS 7.0 在我的服务器上安装框架后,我遇到了问题中提到的相同禁止"错误.当我注意到

Maybe it's useful to someone: After converting my app to MVC 4 with .NET framework 4.5 and installing the framework on my server with IIS 7.0 I encountered the same 'forbidden' error mentioned in the question. I tried all options described above to no avail, when I noticed the

<system.webServer>
 <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

在我的 web.config 中丢失了.添加后,一切正常.简单,但容易被忽视...

was missing from my web.config. After adding this, everything worked. Simple, but easy to overlook...

上面的方案当然可以,但是确实是浪费资源.我认为最好添加评论中 Chris Herring 指出的路由模块.

Of course the solution above will work, but it is indeed a waste of resources. I think it is better to add the routing module as pointed out by Chris Herring in the comments.

<system.webServer>
  <modules>
    <remove name="UrlRoutingModule-4.0" />
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
  </modules>
</system.webServer>

这篇关于IIS 7 中的 ASP MVC 导致:HTTP 错误 403.14 - 禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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