我最近遇到了一个错误,试图用IIS托管我的asp.net站点。我找到了一个很多人信誓旦旦的解决办法。

解决方案: 对文件夹中的文件添加具有读权限的IIS_IUSRS 修改IIS认证方式为BasicAuthentication 刷新网站。会有用的

(http://vivekthangaswamy.blogspot.com/2009/07/aspnet-website-cannot-read.html)

我在我的网里加了什么?配置文件?我以前从来没编辑过。以下是其当前内容:

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
    <connectionStrings>
  <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
 <system.web>
  <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
    </system.web>
</configuration>

我的错误是:

配置错误:由于权限不足,无法读取配置文件 配置文件:\?\ C: \用户* * * * *网站视觉Studio2010 \ \文件\ \ PointsForTime \ web . config


当前回答

我需要添加权限到IUSR(除了ISS-IUSRS,正如其他人建议的那样)。 (参见: http://codeasp.net/blogs/raghav_khunger/microsoft - net/2099/iis - 7 - 5 - windows 7 - http错误- 401 - 3 -未经授权)

其他回答

当IIS应用程序有一个物理路径包含正斜杠/而不是反斜杠\的虚拟目录时,我们就遇到了这种情况。这是在我们的持续交付过程中使用IIS的powershell管理API意外完成的。

错误配置示例- applicationHost.config . Config

<application path="/MySite/MyService" applicationPool="MyAppPool" enabledProtocols="http">
    <virtualDirectory path="/" physicalPath="C:\inetpub\MySite/MyService" />
</application>

确保physicalPath属性不包含正斜杠/,只包含反斜杠\

- applicationHost.config . Config

<application path="/MySite/MyService" applicationPool="MyAppPool" enabledProtocols="http">
    <virtualDirectory path="/" physicalPath="C:\inetpub\MySite\MyService" />
</application>

确保你的网。配置文件没有标记为只读

我将. net CLR版本设置为No Managed Code,一切都开始正常工作。

我也收到了“由于权限不足而无法读取配置文件”的提示。结果是IIS中的ISAPI和CGI限制。NET 4.0 32位和64位被设置为拒绝。把它们都标记为允许修正了我的问题。

当我试图与另一个用户共享站点根文件夹时,我也遇到了同样的问题。某些文件夹失去权限。 因此,我按照Afshin Gh建议的步骤向IIS_IUSRS组添加权限。 问题是这个小组不适合我。我用的是windows 7。

我所做的只是改变了一些步骤:

右键单击父文件夹(失去权限的人), 属性=>安全=>在“组或用户名:”中, 单击Edit…… 将打开“权限文件夹”窗口。 在“组或用户名:”中按ADD…btn, 输入Authen并按检查名称, 您将看到完整的组名“Authenticated Users” 按ok =>应用。 这将再次启用特权。

这对我很管用。