我最近遇到了一个错误,试图用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


当前回答

进入IIS(站点) 右击网站内的项目。输入图像描述 在这里

点击编辑权限。

去保安那儿。 点击编辑按钮。 单击添加按钮。类型COMPUTER_NAME \ IIS_USERS 或 点击前进。 单击“立即查找”按钮。 还有选择的余地。 选择IIS_USERS,点击ok…ok....ok .

其他回答

不像IIS_IUSRS那样授予所有IIS用户访问权,您也可以使用站点仅授予应用程序池标识访问权。这是微软推荐的方法,更多信息可以在这里找到:

https://support.microsoft.com/en-za/help/4466942/understanding-identities-in-iis

https://learn.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities

Fix:

首先查看上面的配置文件参数,以确定需要访问的位置。在本例中,需要访问整个发布文件夹。右键单击文件夹,选择属性,然后选择Security选项卡。

点击编辑…然后添加....

现在看看Internet信息服务(IIS)管理器和应用程序池:

在我的情况下,我的网站在LocalTest应用程序池下运行,然后我输入名称IIS appool \LocalTest

按“检查名称”键,就会找到用户。

给用户所需的访问权限(默认:读取和执行,列出文件夹内容和读取),一切都应该工作。

你不需要改变你的web.config中的任何东西。

问题在于文件系统权限。您的文件权限不允许IIS_IUSRS用户访问web。配置(或可能是任何文件)。更改他们在windows中的文件权限,允许IIS_IUSRS帐户访问它。

我尝试了以前的大部分建议,但都没有用。我无法重新加载网站,所以我编辑了.csproj文件并更改了端口号,它立即工作了:

 <WebProjectProperties>
      <UseIIS>True</UseIIS>
      <AutoAssignPort>True</AutoAssignPort>
      <DevelopmentServerPort>**4000**</DevelopmentServerPort>
      <DevelopmentServerVPath>/</DevelopmentServerVPath>
      <IISUrl>http://localhost:**4000**/</IISUrl>
      <NTLMAuthentication>False</NTLMAuthentication>
      <UseCustomServer>False</UseCustomServer>
      <CustomServerUrl>
      </CustomServerUrl>
      <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
    </WebProjectProperties>

编辑.csproj文件

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

在某些情况下是网络。配置文件格式不正确。 打开网络。配置并粘贴以下代码:

<?XML版本="1.0"编码="utf-8"?> < >配置 > < /配置