ASP.NET IIS7问题

发布于 2024-11-25 01:59:52 字数 248 浏览 0 评论 0原文

我试图在 IIS 7 中运行 asp.net 3.5 Web 应用程序。

它给出以下错误: 由于权限不足,无法读取配置文件

如果我使用本地管理员帐户运行应用程序池,它就可以工作。我正在尝试使其与网络服务帐户一起使用。为此,我将网络服务帐户添加到 IIS_IUSRS 组,并授予 IIS_IUSRS 对 Web 应用程序文件夹的读取权限,这些权限也传播到 web.config 文件。

知道可能出了什么问题吗?

提前致谢

I'm trying to run an asp.net 3.5 web application in IIS 7.

It gives the following error:
Cannot read configuration file due to insufficient permissions

If I run the application pool with a local admin account, it works. I'm trying to make it work with the Network Service account. For that, I added the Network Service account to the IIS_IUSRS group and gave read permissions for IIS_IUSRS on the web application folder, which were also propagated to the web.config file.

Any idea on what may be wrong?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

说谎友 2024-12-02 01:59:52

我设法解决了这个问题。

文件被“加密”。在文件属性、常规选项卡、高级中,有一个用于加密文件的复选框,并且针对解决方案中的所有文件都选中了该复选框。
尽管我们可以正常浏览和打开文件系统中的文件,但ASP.NET无法访问它们。
这个解决方案是由客户发送的,我不确定它是如何得到的。

提示:如果 Windows 资源管理器以不同的颜色(例如绿色)列出您的文件,则表明某些情况不正常;)

感谢您的所有帮助和想法

I managed to solve the problem.

The files were “encrypted”. In the file properties, General tab, Advanced, there is a checkbox to encrypt the file, and it was checked for all files in the solution.
Even though we can browse and open the files normally in the file system, ASP.NET cannot access them.
This solution was sent by a client, I’m not sure how it got like that.

Hint: if windows explorer lists your files in a different color, like green, it’s a sign something is not normal ;)

Thanks for all the help and ideas

千鲤 2024-12-02 01:59:52

I believe the account needs at least read permissions to the applicationhost.config file on the machine (which is stored under %windir%\system32\inetsrv\config.

浪漫人生路 2024-12-02 01:59:52

我认为你应该做几件事。首先,在您的脑海中将 .NET 3.5 想象为带有一些额外程序集的 .NET 2.0,这才是它真正的样子。然后请记住,在 IIS7 中我们有一个新的集成管道。因此,您想要的是使用经典管道运行。接下来,检查您运行的帐户是什么,并授予该帐户访问您网站文件夹的权限。

方法如下:
1. 在 IIS Internet 服务管理器中,将其打开并在树控件的网站列表中选择您的网站。
2. 单击操作栏中的基本设置,您将看到应用程序池是什么。单击“选择”按钮,您将看到它显示“管道模式”和“.Net 框架版本”。您希望它显示 >net Framework Version 2.0(即使您使用的是 3.5)和管道模式:Classic。
3. 如果您没有可供选择的应用程序池,请取消并转到左侧树控件中的应用程序池。单击“添加应用程序池”,然后添加一个标有“Classing .NET AppPool”(如果尚不存在)的应用程序池。选择新的应用程序池并编辑其基本设置,将其设置为 .net Framework 版本 2.0.50727,并将托管管道模式设置为“经典”。单击“确定”。
4. 现在单击高级设置。除非所有程序集都是 64 位,否则请确保“启用 32 位应用程序”设置为 TRUE。托管管道模式会显示“经典”。 *注意这部分:* IDENTITY 字段告诉您网站正在哪个用户帐户下运行,以便您知道哪些内容需要通过 web.config 访问网站根目录的权限。将其设置为“NetworkService”并单击“确定”。
5. 现在返回树视图中的网站,再次转到基本设置,并将应用程序池设置为您刚刚设置的经典管道。
6. 现在转到站点所在的 Windows 文件夹,并授予“NETWORK SERVICE”读取+执行权限。

瞧!完毕。

简单的豌豆柠檬榨汁。无论如何,当您知道如何做时,这很容易!

There's a couple of things I think you should do. First of all, think in your mind of .NET 3.5 as .NET 2.0 with some extra assemblies on the side, which is what it really is. Then remember that in IIS7 we have a new Integrated pipeline. So, what you want is to run using the Classic pipeline. Next, check what the account is that you're running under, and give that account access to your website folders.

Here's how:
1. In IIS Internet Services Manager, open it up and select your website in the list of websites in the tree control.
2. Click on Basic Settings in the Actions bar, and you'll see what the application pool is. Click the SELECT button and you'll see that it says a Pipeline Mode and .Net framework version. You want it to say >net Framework Version 2.0 (even though you're on 3.5) and pipeline mode: Classic.
3. If you don't have an application pool available to choose from, then cancel out and go to Application Pools in the tree control on the left. Click Add Application Pool and add one that says 'Classing .NET AppPool" if its not already there. Select your new app pool and edit its basic settings to set it to .net framework version 2.0.50727 and managed pipeline mode set to Classic. Click ok.
4. Now click on advanced settings. Unless all your assemblies are 64 bit then make sure Enable 32-Bit applications is set to TRUE. Managed Pipeline Mode will say Classic. *PAY ATTENTION TO THIS PART: * The IDENTITY field tells you what user account the website is running under so you know what will need access permission to the root of your website with web.config. Set this to "NetworkService" and click OK.
5. Now go back to your website in the tree view, and go to Basic Settings again, and set the application pool to the Classic pipeline one you just set up.
6. Now go to the windows folder where your site is and give read+execute permissions to "NETWORK SERVICE".

Voila! Done.

Easy peasy lemon squeezy. It's easy when you know how anyway!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文