简体   繁体   English

IIS ApplicationPoolIdentity 没有“临时 ASP.NET 文件”的写权限

[英]IIS ApplicationPoolIdentity does not have write permission to 'Temporary ASP.NET Files'

I am attempting to launch a website from an 'AppPool' called 'SomeAppPool' which uses the 'ApplicationPoolIdentity' and when I do I receive the following error when I launch the website:我试图从名为“SomeAppPool”的“AppPool”启动一个网站,它使用“ApplicationPoolIdentity”,当我启动网站时,我收到以下错误:

The current identity (IIS_APPPOOL\\SomeAppPool) does not have write access to 'c:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\Temporary ASP.NET Files'当前标识 (IIS_APPPOOL\\SomeAppPool) 没有对“c:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\Temporary ASP.NET Files”的写访问权限

I'm launching the website with 'Use Local IIS Web Server' within Visual Studio 2012 (with no debugger attached) under Windows 8.我在 Windows 8 下的 Visual Studio 2012(没有附加调试器)中使用“使用本地 IIS Web 服务器”启动网站。

The first thing I noticed is that the 'Temporary ASP.NET Files' folder does not even exist so there is nothing to set security permissions on.我注意到的第一件事是“Temporary ASP.NET Files”文件夹甚至不存在,因此无需设置安全权限。

The second issue is, even if there was a folder, what permissions would I set?第二个问题是,即使有文件夹,我要设置什么权限? I'm assuming that I should not have to set permissions for each user created through 'ApplicationPoolIdentity'.我假设我不必为通过“ApplicationPoolIdentity”创建的每个用户设置权限。 Right?对?

The current solutions i've seen simply suggest to set the user to 'Network Service' but this seems to break the isolation of the website for which 'ApplicationPoolIdentity' was introduced.我看到的当前解决方案只是建议将用户设置为“网络服务”,但这似乎打破了引入“ApplicationPoolIdentity”的网站的隔离。

This ASP.NET forum answer , unacknowledged in its thread, was the solution for me.这个 ASP.NET 论坛答案,在其线程中未被承认,是我的解决方案。 It's also low-impact: it doesn't try to re-register IIS or give the user dangerous privileges.它的影响也很小:它不会尝试重新注册 IIS 或授予用户危险的权限。 To summarize the answer:总结一下答案:

  1. Open a Command window as an administrator (Start / Programs / Accessories, then right-click over Command Prompt, then choose "Run as administrator").以管理员身份打开命令窗口(开始/程序/附件,然后右键单击命令提示符,然后选择“以管理员身份运行”)。
  2. Enter the following command:输入以下命令:

     C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Aspnet_regiis.exe -ga domain\\user\u003c/code>

Substitute your domain and user for domain\\user\u003c/code> in the example above.用您的域和用户替换上例中的domain\\user\u003c/code> 。 That's all it took.这就是全部。

The Microsoft documentation for Aspnet_regiis.exe is here . Aspnet_regiis.exe 的 Microsoft 文档在此处 Note that the documentation for the -ga switch refers to a bug in versions 3.5 and earlier, where it wouldn't work with local accounts.请注意, -ga开关的文档指的是 3.5 及更早版本中的一个错误,它不适用于本地帐户。 If I'm reading it correctly, domain accounts are supported for all versions and local accounts are supported starting with Framework 4.0.如果我没看错,所有版本都支持域帐户,并且从 Framework 4.0 开始支持本地帐户。


Update 6 June 2017 : For Windows 8 and above, consider the dism command instead. 2017 年 6 月 6 日更新:对于 Windows 8 及更高版本,请考虑使用dism命令。 It's covered in this SO answer .它包含在这个 SO answer 中 Thanks to @codebrain for suggesting this.感谢@codebrain 提出这个建议。


Update 7 July 2015 : @Vertigo kindly commented that this answer also worked for the NETWORK SERVICE account in .NET 2.0 under 2008R2/2012, so my disclaimer above about local accounts pre-4.0 may be wrong. 2015 年 7 月 7 日更新:@Vertigo 善意地评论说,这个答案也适用于 2008R2/2012 下 .NET 2.0 中的NETWORK SERVICE帐户,所以我上面关于 4.0 之前的本地帐户的免责声明可能是错误的。

If anyone else finds that this works for a local account under .NET 3.5 or earlier, please feel free to edit my answer or to note it in the comments;如果其他人发现这适用于 .NET 3.5 或更早版本的本地帐户,请随时编辑我的答案或在评论中注明; it would be a great help to others who may experience this same problem.对于可能遇到同样问题的其他人来说,这将是一个很大的帮助。

I faced same problem.我遇到了同样的问题。 I checked the path c:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\ looking for Temporary ASP.NET Files , but there was not any folder by this name.我检查了路径c:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\寻找Temporary ASP.NET Files ,但没有任何该名称的文件夹。 so I created a new folder manually and named it Temporary ASP.NET Files and problem fixed.所以我手动创建了一个新文件夹并将其命名为Temporary ASP.NET Files并修复了问题。

So ensure the mentioned path exists.因此,请确保上述路径存在。

Along with the up voted solutions, Please check your disk space and make sure there is enough disk space available.随着投票的解决方案,请检查您的磁盘空间并确保有足够的可用磁盘空间。

I just ran in to this issue on one of our production server and it was related to the low disk space.我刚刚在我们的一台生产服务器上遇到了这个问题,它与磁盘空间不足有关。

我通过将应用程序池使用的用户添加到 IIS_IUSRS 组解决了该错误。

Being in the C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319 try running the aspnet_regiis.exe command.C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319尝试运行aspnet_regiis.exe命令。

Typically the permissions should be set up.通常应该设置权限。 If Windows Add/Remove Programs happen, or if new .NET versions get installed, these things get reset a bit.如果 Windows 添加/删除程序发生,或者如果安装了新的 .NET 版本,这些东西会被重置。 Running the aspnet_regiis.exe should help there.运行aspnet_regiis.exe应该会有所帮助。

Also, ensure you're running Visual Studio as an Administrator.此外,请确保您以管理员身份运行 Visual Studio。

We're 2021 now, but ran into this issue as well on a Windows Server 2019.我们现在是 2021 年,但在 Windows Server 2019 上也遇到了这个问题。

The error CS0016 was misleading in my case: Giving permissions for ApplicationPool-Identities or similar users on the Temporary ASP.NET Files didn't work and wasn't the actual issue. CS0016 错误在我的案例中具有误导性:在Temporary ASP.NET Files上授予 ApplicationPool-Identities 或类似用户的权限不起作用,也不是实际问题。

After installing a fresh server, Users does not have permission to modify the temp folder in the C:\\Windows directory .安装新服务器后, Users无权修改C:\\Windows directory的临时文件夹。 When .NET needs to write temporary files to the temp folder, an exception occurs because of no permission to write.当.NET需要向temp文件夹写入临时文件时,会出现无写入权限的异常。

Assigning modify permissions for Users to the temp folder under the C:\\Windows directory worked for me.Users modify权限分配给C:\\Windows目录下的临时文件夹对我有用。

I just ran into this and what I did was to create a new account, lets say its "Webby".我刚刚遇到了这个问题,我所做的是创建一个新帐户,可以说是“Webby”。

In ISS, go into Advance Settings of your page and change "Physical Path Credentials" to the Webby account.在 ISS 中,进入页面的高级设置并将“物理路径凭据”更改为 Webby 帐户。 The Path field above that has the webpage directory;上面有网页目录的Path字段; open this folder in Explorer and add Webby with Modify permissions.在资源管理器中打开此文件夹并添加具有修改权限的 Webby。 Under "Failed Request Tracing" there's a logs directory;在“失败的请求跟踪”下有一个日志目录; add modify to that too and set "Enabled" to true (you can turn it off later, but make sure it'll work).也添加修改并将“启用”设置为true(您可以稍后将其关闭,但要确保它可以工作)。 At this point you can try your site and you should definitely get the error message, because of the user you are using.此时您可以尝试您的站点,并且您肯定会收到错误消息,因为您正在使用的用户。

The current identity (YOUR\\Webby) does not have write access to 'C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files'.当前身份 (YOUR\\Webby) 没有对“C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files”的写访问权限。

Now, to fix your problem, you will need to go to the 'C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files' directory and add Webby to that as well, again Modify works.现在,要解决您的问题,您需要转到“C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files”目录并将 Webby 添加到该目录中,再次修改工作。

The solution of using a special account just for websites is a good idea.为网站使用特殊帐户的解决方案是一个好主意。 It is a real account (not virtual like ApplicationPool) and Windows doesn't get confused (...as easily).它是一个真实的帐户(不像 ApplicationPool 那样虚拟)并且 Windows 不会被混淆(......很容易)。

Hope this helps.希望这可以帮助。

In IIS7, I right clicked on the virtual directory, removed the application and added it again.在 IIS7 中,我右键单击虚拟目录,删除应用程序并再次添加它。 That fixed it for me.那为我修好了。

我通过释放磁盘空间解决了它

I have had this problem, and I can resolved it.我遇到了这个问题,我可以解决它。 You only have to give permissions to the folder: C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files, for your current user.您只需为当前用户授予以下文件夹的权限:C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files。 It's easily.这很容易。

Good luck!!祝你好运!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM