HTTP 403禁止访问:拒绝访问ASP.NET Web API [英] HTTP 403 Forbidden: Access is denied ASP.NET Web API

查看:89
本文介绍了HTTP 403禁止访问:拒绝访问ASP.NET Web API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在生产服务器上运行ASP.NET Web API项目时,出现以下错误.

I'm getting the following error when running our ASP.NET Web API project on our production server.

403-禁止访问:拒绝访问.您无权查看 使用您提供的凭据访问此目录或页面.

403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied.

查看IIS 7.0错误会记录基本错误

Looking at the IIS 7.0 error logs the underlying error is

403.14-目录列表被拒绝.

403.14 - Directory listing denied.

我已经配置了生产服务器,因此它与登台服务器(有效)具有相同的设置.身份验证,模块,授权,权限等都是相同的.

I have configured the production server so it has the same settings as the staging server (which works). The authentication, modules, authorization, permissions etc are all identical.

在此线程中遵循建议 403-禁止访问:被拒绝.通过将 runAllManagedModulesForAllRequests ="true" 添加到我的web.config文件中,我设法使ASP.Net MVC正常工作.

Following a suggestion in this thread 403 - Forbidden: Access is denied. ASP.Net MVC I have managed to get it working by adding runAllManagedModulesForAllRequests="true" to my web.config file.

<模块runAllManagedModulesForAllRequests ="true">

<modules runAllManagedModulesForAllRequests="true">

虽然这行得通,但我认为这不是一个长期解决方案,因为它将导致服务器上不必要的负载.

Whilst this works I don't see this as a long term solution as it will cause unnecessary load on the server.

因此,这似乎表明未加载的东西应该被加载.

So it seems to indicate that something isn't getting loaded that should be getting loaded.

推荐答案

如果您没有访问文件夹/web.config文件的权限,则会弹出上述错误.

The above error will pop up when you do not have the permission to access the folder/web.config file.

尝试以下

  1. 在Windows资源管理器中,找到关联的web.config文件 应用程序.
  2. 右键单击web.config文件
  3. 单击属性.
  4. 单击安全性"选项卡,然后单击编辑".
  5. 点击添加.
  6. 在输入要选择的对象名称"框中,IUSR,单击检查". 名称,然后单击确定.
  7. 提供完全控制",然后单击确定".
  8. 在"Web.config属性"对话框中,单击确定".
  1. In Windows Explorer, locate the web.config file that is associated with the application.
  2. Right-click the web.config file
  3. Click Properties.
  4. Click the Security tab, and then click Edit.
  5. Click Add.
  6. In the Enter the object names to select box, IUSR, click Check Names, and then click OK.
  7. Provide Full control, and then click OK.
  8. In the Web.config Properties dialog box, click OK.

我认为应该可以.

这篇关于HTTP 403禁止访问:拒绝访问ASP.NET Web API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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