无法读取配置文件,由于权限不足 [英] Cannot read configuration file due to insufficient permissions

查看:1806
本文介绍了无法读取配置文件,由于权限不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到一个错误尝试举办我的asp.net网站与IIS。我已经找到了解决方案,许多发誓。


  

解决方案:
  1.文件添加与读取权限IIS_IUSRS的文件夹中
  2.更改IIS身份验证方法BasicAuthentication
  3.刷新网页。它将工作


(<一个href=\"http://vivekthangaswamy.blogspot.com/2009/07/aspnet-website-cannot-read.html\">http://vivekthangaswamy.blogspot.com/2009/07/aspnet-website-cannot-read.html)

我怎么添加到我的web.config文件有关系吗?我以前从来没有对其进行编辑。下面是它的当前内容:

 &LT;?XML版本=1.0&GT?;
&LT;! -
  有关如何配置ASP.NET应用程序的更多信息,请访问:
  http://go.microsoft.com/fwlink/?LinkId=169433
   - &GT;
&LT;结构&gt;
    &LT;&是connectionStrings GT;
  &LT;添加名称=DefaultConnection的connectionString =数据源= \\ SQLEX $ P $干燥综合征; AttachDbFilename = | DataDirectory目录| \\ Database.mdf;集成安全=真;用户实例=真
   的providerName =System.Data.SqlClient的/&GT;
 &LT; /&是connectionStrings GT;
 &LT;&的System.Web GT;
  &LT;编译调试=真正的严=false的明确=真targetFramework =4.0/&GT;
    &LT; /system.web>
&LT; /结构&gt;

我的错误是:

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


解决方案

没有与你的web.config问题即可。您的网站的过程中运行。在IIS中您可以定义进程的标识。在身份的是,你的网站的应用程序池运行作为(网络服务,本地系统的等...),应该有权限访问和读取web.config文件。

更新:

这个更新答案是与上述相同,但更长和更简单的和改进的一点。

的首先:你没有改变你的配置文件中的任何东西。 这是确定。问题是与 Windows文件权限

,会出现此问题,因为您的应用程序不能访问阅读的web.config 文件。

请在文件访问的 IIS_IUSRS 组。刚右键单击we​​b.config中并点击性质 安全标签下添加 IIS_IUSRS

那么,这是什么东西IIS_IUSRS?

您的网站像一个exe 文件。就像任何exe文件,应由用户启动并运行的根据权限分配给该用户。

在您的网站中的 IIS 应用程序池您的网站用户关联网络服务开始,本地系统的等...)(可以在IIS中被改变)

所以,当你说的 IIS_IUSRS ,这意味着任何用户网络服务,本地系统的等...)你的网站正在运行的。

和为 @Seph 下面评论提到:的如果您的计算机是一个域的,请记住, IIS_IUSRS 组是一个本地组即可。

I've recently encountered an error trying to host my asp.net site with IIS. I have found a solution that many swear by.

Solution: 1. Add IIS_IUSRS with Read permission on files in the folder 2. Change IIS authentication method to BasicAuthentication 3. refresh the website. It will work

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

What do I add to my web.config file though? I've never had to edit it before. Here is its current contents:

<?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>

My error is:

Config Error:   Cannot read configuration file due to insufficient permissions
Config File:    \\?\C:\Users\*****\Documents\Visual Studio2010\WebSites\PointsForTime\web.config

解决方案

There is no problem with your web.config. Your web site runs under a process. In iis you can define the identity of that process. The identity that, your web site's application pool runs as (Network Services, Local System, Etc. ...), should have permission to access and read web.config file.

Update:

This updated answer is same as above, but a little longer and simpler and improved.

First of all: you don't have to change any thing in your config file. It's OK. The problem is with windows file permissions.

This problems occurs because your application can not access and read web.config file.

Make the file accessible to IIS_IUSRS group. Just right click web.config and click properties, under security tab, add IIS_IUSRS.

So what is this IIS_IUSRS thing?

Your web site is like an exe file. Just like any exe file, it should be started by a user and it runs according to permissions assigned to that user.

When your site is started in IIS, Application Pool of your web site is associated with a user (Network Services, Local System, Etc. ...) (and can be changed in IIS)

So when you say IIS_IUSRS, it means any user (Network Services, Local System, Etc. ...) that your site is running as.

And as @Seph mentioned in comment below: If your computer is on a domain, remember that IIS_IUSRS group is a local group.

这篇关于无法读取配置文件,由于权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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