asp.netappfabric

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


I am deploying a version of my website which I have developed AppFabric integration into, instead of using the ASP.NET Memory Cache (we're going to load balance a few web servers, so need distributed caching as opposed to local RAM caching).

Locally, I have AppFabric 1.1 installed, and my website communicates with it over 'localhost' (AppFabric installed on the same computer as the website runs out).

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

When I deploy this site to one of the test servers in our hosting environment (with AppFabric 1.1 also installed locally on that server), the site in IIS immediately fails, in under one second. If I stop IIS and then start it again, and then refresh the page locally, I get the IIS generic "HTTP Error 500.0 - Internal Server Error" in 800ms. This surprised me - I thought the site would be spinning up ASP.NET stuff and not actually running "user code" in that quick of a time.

So all the site's data access has changed to the pattern of, "check AppFabric for object, if it doesn't exist, retrieve from DB & store inside AppFabric" - so it seems

If I deploy a version of the site to the exact same folder, with all of the AppFabric caching changed to use the in-memory ASP.NET cache, then the site loads with no issues, so the problem is 100% related to AppFabric.

There is no exception logged, I simply see the generic "HTTP 500.0 Internal Server Error" message. If I check the Event Viewer then I can see an exception logged:

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: 

There is no stacktrace to show WHERE the failure is occurring.

I have configured AppFabric's security like this (as a test) - and as shown in the web.config, we talk to AppFabric with 'None' for both security mode & protection level.

Set-CacheClusterSecurity -SecurityMode None -ProtectionLevel None

I have hit a brick wall with this and am not sure where else to turn. I tried to install AppFabric 1.0 on the server but it is no longer supported on Windows 2016.

Locally I am using AppFabric 1.1 and am running on Windows 10. As stated, if I deploy the exact same codebase, just with AppFabric communication replaces with .NET memory cache then the site loads okay on the server, which is why I'm convinced it's related to AppFabric.

Does anyone have any pointers as to where I can start to look into this further? I tried


Solution

  • Turns out, ELMAH was catching the exception and still creating the XML log file. This pointed me towards 'Access to the 'global' registry key is denied' - you have to add the application pool user to the 'performance log' and 'performance monitor' user groups.