ASP.Net / AppFabric 导致 4011 错误 "An unhandled access exception has occurred."

ASP.Net / AppFabric causes 4011 error "An unhandled access exception has occurred."

我正在部署我的网站的一个版本,我已经将 AppFabric 集成到其中,而不是使用 ASP.NET 内存缓存(我们将对一些 Web 服务器进行负载平衡,因此需要分布式缓存作为反对本地 RAM 缓存)。

在本地,我安装了 AppFabric 1.1,我的网站通过 'localhost' 与它通信(AppFabric 安装在网站用完的同一台计算机上)。

<dataCacheClient>
    <hosts>
        <host name="localhost" cachePort="22233" />
    </hosts>
    <securityProperties mode="None" protectionLevel="None" />       
</dataCacheClient>  

当我将此站点部署到我们托管环境中的一台测试服务器时(AppFabric 1.1 也在本地安装在该服务器上),IIS 中的站点立即失败,不到一秒钟。如果我停止 IIS 然后重新启动它,然后在本地刷新页面,我会在 800 毫秒内获得 IIS 通用 "HTTP Error 500.0 - Internal Server Error"。这让我感到惊讶 - 我认为该网站会在那么短的时间内旋转 ASP.NET 东西而不是实际上 运行 "user code"。

因此所有站点的数据访问都已更改​​为 "check AppFabric for object, if it doesn't exist, retrieve from DB & store inside AppFabric" 的模式 - 看起来

如果我将站点的一个版本部署到完全相同的文件夹,并且所有 AppFabric 缓存都更改为使用内存中 ASP.NET 缓存,那么站点加载没有问题,所以问题100% 与 AppFabric 相关。

没有记录异常,我只是看到通用的 "HTTP 500.0 Internal Server Error" 消息。如果我检查事件查看器然后我可以看到记录的异常:

Event code: 4011 
Event message: An unhandled access exception has occurred. 
Event time: 01/12/2017 12:37:19 
Event time (UTC): 01/12/2017 12:37:19 
Event ID: 84321f68413340daaf0badf122ceed87 
Event sequence: 4 
Event occurrence: 1 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/1/ROOT-3-131566054392620836 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: ..\..\..\..httpdocs-shared-cache\ 
    Machine name: machine

Process information: 
    Process ID: 26752 
    Process name: w3wp.exe 
    Account name: -

Request information: 
    Request URL: https://localhost:443/Index.aspx 
    Request path: /Index.aspx 
    User host address: ::1 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: -

Custom event details: 

没有堆栈跟踪显示故障发生的位置。

我已经像这样配置了 AppFabric 的安全性(作为测试)- 如 web.config 所示,我们通过 'None' 与 AppFabric 讨论安全模式和保护级别。

Set-CacheClusterSecurity -SecurityMode None -ProtectionLevel None

我遇到了困难,不知道还能转向哪里。我尝试在服务器上安装 AppFabric 1.0,但 Windows 2016 不再支持它。

我在本地使用 AppFabric 1.1 并且 运行 在 Windows 10。如前所述,如果我部署完全相同的代码库,只需将 AppFabric 通信替换为 .NET 内存缓存,然后站点在服务器上加载正常,这就是为什么我确信它与 AppFabric 有关。

有没有人指出我可以从哪里开始进一步研究这个问题?我试过了

事实证明,ELMAH 正在捕获异常并仍在创建 XML 日志文件。这将我指向“访问 'global' 注册表项被拒绝” - 您必须将应用程序池用户添加到 'performance log' 和 'performance monitor' 用户组。