asp.net-mvc HTTP 错误 403.14 - ASP.Net MVC 4 应用程序的禁止的 IIS 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15323190/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTTP Error 403.14 - Forbidden IIS Error for ASP.Net MVC 4 Application
提问by Pezhman Parsaee
we developed an asp.net mvc 4 application. in vs 2012 this work fine. we publish this web application and putting it on iis 7.5, but when we want to browse web application through iis, this error message was show:
我们开发了一个 asp.net mvc 4 应用程序。在 vs 2012 中这个工作正常。我们发布了这个 web 应用程序并将其放在 iis 7.5 上,但是当我们想通过 iis 浏览 web 应用程序时,显示此错误消息:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
we think that this error may be from this web application, but we create another asp.net mvc 4 application (without any change and with internet template) and putting it on iis, and again top error show to us.
我们认为这个错误可能来自这个 web 应用程序,但我们创建了另一个 asp.net mvc 4 应用程序(没有任何更改并使用 Internet 模板)并将其放在 iis 上,并再次向我们显示顶级错误。
we search in the internet and see more poeples that this problem was happened for their. for example in this: 403 - Forbidden on basic MVC 3 deploy on iis7.5link introduce an idea for solve this problem and assume that this problem was solved for their poeple, but this solution not work for me. another links that we say includes: this https://stackoverflow.com/questions/6885509/http-error-403-14-forbiddenand this: http://yassershaikh.com/http-error-403-14-forbidden-the-web-server-is-configured-to-not-list-the-contents-of-this-directory/but this solutions not work for me
我们在互联网上搜索,看到更多的人说这个问题是为他们发生的。例如在这个:403 - Forbidden on basic MVC 3 deploy on iis7.5link 介绍了解决这个问题的想法,并假设这个问题已经为他们的人解决了,但这个解决方案对我不起作用。我们说的另一个链接包括:这个 https://stackoverflow.com/questions/6885509/http-error-403-14-forbidden和这个:http: //yassershaikh.com/http-error-403-14-forbidden- the-web-server-is-configured-to-not-list-the-contents-of-this-directory/但这个解决方案对我不起作用
any idea for solve this problem?
解决这个问题的任何想法?
采纳答案by Pezhman Parsaee
an update for IIS is solved my problem, that can be downloaded from below link: http://support.microsoft.com/kb/980368
IIS 的更新解决了我的问题,可以从以下链接下载:http: //support.microsoft.com/kb/980368
回答by Maurizio Macagno
I had the same problem on a brand new machine, after installing IIS 7.5, Visual Studio etc. I ended up refreshing ASP.NET registration and it worked.
我在一台全新的机器上遇到了同样的问题,在安装了 IIS 7.5、Visual Studio 等之后。我最终刷新了 ASP.NET 注册并且它工作了。
C:\windows\Microsoft.NET\Framework64\v4.0.30319> .\aspnet_regiis.exe -ir C:\windows\Microsoft.NET\Framework64\v4.0.30319> iisreset
C:\windows\Microsoft.NET\Framework64\v4.0.30319> .\aspnet_regiis.exe -ir C:\windows\Microsoft.NET\Framework64\v4.0.30319> iisreset
HTH
HTH
回答by Ajay Suwalka
First You should register the framework for IIS by executing following command in command prompt as
首先,您应该通过在命令提示符下执行以下命令来为 IIS 注册框架
C:\windows\Microsoft.NET\Framework\v4.0.30319> aspnet_regiis.exe -i C:\windows\Microsoft.NET\Framework64\v4.0.30319> aspnet_regiis.exe -i
C:\windows\Microsoft.NET\Framework\v4.0.30319> aspnet_regiis.exe -i C:\windows\Microsoft.NET\Framework64\v4.0.30319> aspnet_regiis.exe -i
If you still get an error as
如果您仍然收到错误消息
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory
HTTP 错误 403.14 - Forbidden Web 服务器配置为不列出此目录的内容
Then probably you need an update for IIS which is used when URLs do not end with a period
那么可能您需要更新 IIS,当 URL 不以句点结尾时使用
Please visit the following link for update http://support.microsoft.com/kb/980368
请访问以下链接进行更新 http://support.microsoft.com/kb/980368
An update is available that enables certain IIS 7.0 or IIS 7.5 handlers to handle requests whose URLs do not end with a period
可用更新使某些 IIS 7.0 或 IIS 7.5 处理程序能够处理 URL 不以句点结尾的请求
回答by Seth
This happened to me because I mistakenly ran an unrelated search and replace that renamed the 'id' parameter (3rd line) in Global.asax.cs:
这发生在我身上,因为我错误地运行了一个不相关的搜索并替换了 Global.asax.cs 中重命名的“id”参数(第 3 行):
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
...to another name. I immediately started getting 403.14 locally and remotely. Changing it back to 'id' fixed it.
……换个名字。我立即开始在本地和远程获取 403.14。将其改回“id”修复了它。
回答by Lucky
Open Elevated Command Prompt in Windows (Run command prompt as Administrator).
在 Windows 中打开提升的命令提示符(以管理员身份运行命令提示符)。
And run the command aspnet_regiis -iat the .Net Framework and .Net Framework64 location. Just like below, Here parameter imeans install the ASP.NET version 4. The first command is for 32 bit and second is for installing the 64bit version.
并aspnet_regiis -i在 .Net Framework 和 .Net Framework64 位置运行命令。就像下面一样,这里的参数i表示安装 ASP.NET 版本 4。第一个命令是 32 位,第二个是安装 64 位版本。
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -i
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -i


The commands is used to register ASP.NET applications with Internet Information Services (IIS) server.
这些命令用于向 Internet 信息服务 (IIS) 服务器注册 ASP.NET 应用程序。
回答by Brian Kirkpatrick
Perhaps... If you happen to use the Publish Wizard (like I did) and select the "Precompile during publishing" checkbox (like I did) and see the same symptoms...
也许......如果您碰巧使用发布向导(就像我一样)并选择“发布期间预编译”复选框(就像我一样)并看到相同的症状......
Yeah, I beat myself over the head, but after unchecking this box the, seemingly unrelated setting, all the symptoms described go away.
是的,我打败了自己,但在取消选中此框后,看似无关的设置,所描述的所有症状都消失了。
Hopefully this fixes some folks.
希望这能解决一些人。
回答by user641770
I would comment on @Seth's answer if I had 50 rep. It's not just a search and replace problem. There is a Rename Bug">Refactor --> Rename Bugin Visual Studio 2012 that wrongly renamed the "id" inside the literal stringvalue of the url parameter in my RouteConfig.cs. Of course, it's resolved as "won't fix", so be warned.
如果我有 50 个代表,我会评论 @Seth 的回答。这不仅仅是一个搜索和替换问题。Visual Studio 2012 中有一个重命名错误">重构 --> 重命名错误,它错误地重命名了我的 RouteConfig.cs 中 url 参数的文字字符串值中的“id” 。当然,它已解决为“无法修复”,因此请注意。
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
was changed to
改为
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{replaced_text}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
回答by Sam
It sounds like the application is not correctly configured. Ensure that your web.config has been deployed, along with all of your application files and that the application pool is configured correctly.
听起来应用程序没有正确配置。确保您的 web.config 以及所有应用程序文件都已部署,并且应用程序池配置正确。
If you access the machine running IIS directly you will likely get a more detail error message.
如果您直接访问运行 IIS 的计算机,您可能会收到更详细的错误消息。
回答by Alasdair Cameron
In my case the problem was with the Physical Path setting.
就我而言,问题出在物理路径设置上。
It was pointing to C:\inetpub\wwwroot\MySite
它指向 C:\inetpub\wwwroot\MySite
but the imported site was actually at C:\inetpub\wwwroot\MySite\Default Web Site\MySite
但导入的站点实际上在 C:\inetpub\wwwroot\MySite\Default Web Site\MySite
I changed the path in iis via MySite -> Edit Site -> Basic Settingsand I was off to the races.
我通过MySite -> Edit Site -> Basic Settings更改了 iis 中的路径, 然后我就开始参加比赛了。
回答by stroopwafel
Had the same error (403.14) after copying a working ConnectionString from my web.config on a newer project to replace the ConnectionString on an old project then started doing testing on localdb and received the error. Note: I copied, from new web.config to old web.config, the connectionString portion of the connectionstring only and did not make any changes to the name or providername on the old project. After researching for several hours finally went into one of the attached sqldatasources on the old project (on the design tab in VS 2012) and re-configured the sqldatasource (clicked "configure data source") and in the first dropdown box selected the name associated with one of the recently copied ConnectionStrings. That was all it took to get going and after reconfiguring the ConnectionString it started working. Suspect that when I copied over the ConnectionString from the new project to the old project that the default table specified in the sqldatasource assignment process might have been lost?
从我的 web.config 中复制一个新项目上的工作 ConnectionString 以替换旧项目上的 ConnectionString 后,出现相同的错误(403.14),然后开始在 localdb 上进行测试并收到错误。注意:我仅将连接字符串的 connectionString 部分从新 web.config 复制到旧 web.config,并没有对旧项目的名称或提供者名称进行任何更改。经过几个小时的研究,终于进入了旧项目(在 VS 2012 的设计选项卡上)的一个附加 sqldatasources 并重新配置了 sqldatasource(单击“配置数据源”)并在第一个下拉框中选择了关联的名称使用最近复制的 ConnectionStrings 之一。这就是开始工作所需要的一切,在重新配置 ConnectionString 后,它开始工作。

