.net MVC4 HTTP 错误 403.14 - 禁止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11425574/
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
MVC4 HTTP Error 403.14 - Forbidden
提问by mithun_daa
I have build a .net4.5 ASP.NET MVC4 web app which works fine locally (IIS Express & dev server) but once i deploy it to my web server it throws the 403 error. I have installed .Net 4.5RC on the server and even tried the
aspnet_regiis -ibit that everyone recommended for their issues with previous versions of MVC/.Net but it did not help.
我已经构建了一个 .net4.5 ASP.NET MVC4 web 应用程序,它在本地运行良好(IIS Express 和开发服务器),但是一旦我将它部署到我的 web 服务器,它就会抛出 403 错误。我已经在服务器上安装了 .Net 4.5RC,甚至尝试了
aspnet_regiis -i每个人都推荐的解决以前版本的 MVC/.Net 问题的方法,但没有帮助。
Any ideas?
有任何想法吗?
EDIT: More info about the situation. The server is 32bit and I have 4 other MVC3 applications that work fine. It is just my MVC4 app that is not working.
编辑:有关情况的更多信息。服务器是 32 位的,我还有 4 个其他 MVC3 应用程序可以正常工作。只是我的 MVC4 应用程序不起作用。
回答by MarkKGreenway
Try
尝试
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Via
通过
https://serverfault.com/questions/405395/unable-to-get-anything-except-403-from-a-net-4-5-website
https://serverfault.com/questions/405395/unable-to-get-anything-except-403-from-a-net-4-5-website
回答by Tommy
Error 403.14 is the HTTP error code for not being allowed to list the contents of a directory. Please be sure that
错误 403.14 是不允许列出目录内容的 HTTP 错误代码。请确保
- You have setup the website as an application in IIS
- You have .NET 4.5 installed on the server
- You have set the application pool to run the proper version of the .NET framework (ie. it is not set to .NET 2.0
- You are using the integrated pipeline on your application pool
- .NET 4.5 is actually registered in IIS. Please see this postfor a similar issue/resolution
- 您已将网站设置为 IIS 中的应用程序
- 您在服务器上安装了 .NET 4.5
- 您已将应用程序池设置为运行正确版本的 .NET 框架(即未设置为 .NET 2.0
- 您正在应用程序池中使用集成管道
- .NET 4.5 实际上是在 IIS 中注册的。请参阅此帖子以获取类似的问题/解决方案
Usually, a and d are the biggest issues surrounding MVC deployments to IIS
通常,a 和 d 是围绕 MVC 部署到 IIS 的最大问题
回答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, a seemingly unrelated setting, all the symptoms described go away after redeploying.
是的,我把自己打败了,但是在取消选中此框后,一个看似无关的设置,重新部署后描述的所有症状都消失了。
Hopefully this fixes some folks.
希望这能解决一些人。
回答by Kurkula
回答by Jason Koopmans
Before applying
申请前
runAllManagedModulesForAllRequests="true"/>
consider the link below that suggests a less drastic alternative. In the post the author offers the following alteration to the local web.config:
考虑下面的链接,它表明了一个不那么激烈的替代方案。在帖子中,作者对本地 web.config 进行了以下更改:
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
http://www.britishdeveloper.co.uk/2010/06/dont-use-modules-runallmanagedmodulesfo.html
http://www.britishdeveloper.co.uk/2010/06/dont-use-modules-runallmanagedmodulesfo.html
回答by user641770
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. This caused a 403.14 on a fresh and otherwise correct setup in both Windows Server 2012 and Windows Server 2008 R2.
Visual Studio 2012 中有一个重命名错误">重构 --> 重命名错误,它错误地重命名了我的 RouteConfig.cs 中 url 参数的文字字符串值中的“id” 。这导致 Windows Server 2012 和 Windows Server 2008 R2 中全新且正确的设置出现 403.14。
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}/{renamed_text}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
回答by Mastro
If you're running IIS 8.5 on Windows 8, or Server 2012, you might find that running mvc 4/5 (.net 4.5) doesn't work in a virtual directory. If you create a local host entry in the host file to point back to your local machine and then point a new local IIS website to that folder (with the matching host header entry) you'll find it works then.
如果您在 Windows 8 或 Server 2012 上运行 IIS 8.5,您可能会发现在虚拟目录中运行 mvc 4/5 (.net 4.5) 不起作用。如果您在主机文件中创建一个本地主机条目以指向您的本地计算机,然后将一个新的本地 IIS 网站指向该文件夹(带有匹配的主机标头条目),那么您会发现它可以工作。
回答by marcusdev
You can also get a 403 if when testing with dev server you are using integrated pipeline and then install as classic pipeline mode on your live IIS 7.5 web server, also I was missing my app_data folder which also was required
如果在使用开发服务器进行测试时使用集成管道,然后在实时 IIS 7.5 Web 服务器上安装为经典管道模式,您也可以获得 403,而且我也缺少我的 app_data 文件夹,这也是必需的
回答by Jinto John
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
U can use above code
你可以使用上面的代码
回答by Leniel Maccaferri
I had set the new app's application pool to the DefaultAppPoolin IIS which obviously is using the Classicpipeline with .NET v.2.0.
我已将新应用程序的应用程序池设置为DefaultAppPoolIIS 中的 IIS 显然正在使用Classic带有.NET v.2.0.
To solve the problem I created a new App Pool using the Integratedpipeline and .NET v4.0. just for this new application and then everything started working as expected.
为了解决这个问题,我使用Integrated管道和.NET v4.0. 只是为了这个新应用程序,然后一切都按预期开始工作。
Don't forget to assign this new app pool to the application. Select the application in IIS, click Basic Settingsand then pick the new app pool for the app.
不要忘记将这个新的应用程序池分配给应用程序。在 IIS 中选择应用程序,单击Basic Settings,然后为应用程序选择新的应用程序池。


