AppDomain的影子复制的文件访问被拒绝在ASP.NET网站上运行的IIS6 [英] AppDomain shadow copied file access denied with ASP.NET site running on IIS6

查看:276
本文介绍了AppDomain的影子复制的文件访问被拒绝在ASP.NET网站上运行的IIS6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些麻烦的AppDomain的结合在IIS中运行一个ASP.NET网站的卷影副本功能。问题是,影子复制的文件不能使用,因为没有足够的权限由IIS用户读取或执行。

I have some trouble with the shadow copy feature of AppDomains in combination with a ASP.NET website running under IIS. The problem is that the shadow copied files can not be read or executed by the IIS user because of insufficient permissions.

我收到以下错误消息时执行新的AppDomain的code(经由DoCallBack回调方法):结果
System.IO.FileLoadException:无法加载文件或程序集My.Namespace.AssemblyName,版本= 0.0.3.2231,文化=中性公钥= null或它的一个依赖。访问被拒绝。

I get the following error message when the code in the new AppDomain is executed (through a callback method via DoCallBack):
System.IO.FileLoadException: Could not load file or assembly 'My.Namespace.AssemblyName, Version=0.0.3.2231, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.

融合日志:

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = My.Namespace.AssemblyName, Version=0.0.3.2231, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Inetpub/wwwroot/Web Suite/Widgets
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: \\?\C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Inetpub/wwwroot/Web Suite/Widgets/My.Namespace.AssemblyName.DLL.
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.

我已经这样做:结果
我已授予了C:/的Inetpub / wwwroot文件/网页套房/小工具,为用户的网络服务文件夹读取和执行权限结果
当我关掉阴影复制功能,一切顺利。结果
即使是Visual Studio 2008中在我的本地计算机上运行没有任何问题。结果
授予在Widgets文件夹中的所有文件(而不是文件夹本身)读取和执行权限没有解决这个问题。

What I have already done:
I have granted the 'C:/Inetpub/wwwroot/Web Suite/Widgets' folder read and execution permission for the user 'NETWORK SERVICE'.
When I turn off the shadow copying feature, everything goes fine.
Even on my local computer under Visual Studio 2008 it runs without any problem.
Granting all files (instead of the folder itself) in the Widgets folder read and execution permission does not solve the problem.

我认为它有对ASP.NET临时文件夹的权限做:结果
C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\临时ASP.NET文件\\ WEB套件结果
此文件夹,它的所有子文件夹和它们内部的文件已经阅读并阅读&安培;执行为用户的网络服务的权限。所以这不是问题无论是。

I thought it have to do with the permissions on the ASP.NET temporary files folder:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\web suite
This folder, all its sub folders and the files within them have read and read & execute permissions for the user 'NETWORK SERVICE'. So that's not the problem either.

要短:结果
为什么不能我的网站(IIS6下运行)访问卷影复制的新的AppDomain的文件?

推荐答案

这个问题的原因是CachePath默认值。如果一个程序池是根据网络服务运行,DefaultUser临时文件夹位置时(不知道为什么)。但网络服务不具有访问权限的文件夹,它的异常的原因。解决的办法是设置CachePath明确。例如,我们可以使用ASP.NET程序池缓存路径:

The reason of the problem is CachePath default value. If an AppPool is run under network service, DefaultUser temp folder location is used (I don't know why). But Network Service doesn't have access to the folder and it's the reason of the exception. The solution is to set CachePath explicitly. For example, we can use ASP.NET AppPool cache path:

var domainInfo = new AppDomainSetup
  {
    CachePath = AppDomain.CurrentDomain.SetupInformation.CachePath
    /* ...*/
  };

这篇关于AppDomain的影子复制的文件访问被拒绝在ASP.NET网站上运行的IIS6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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