I have this code running on 8 servers. Now I'm standing up the next 4.
I've reproduced this issue on all 4 servers.

At first, I get:

System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations.

and it lists the correct location of index.cshtml

Then I recycle the website in IIS. From then on, all I get is:

Could not load file or assembly 'Microsoft.CSharp, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)

I've reproduced this sequence on all 4 new servers.

The 4th, I didn't recycled from IIS, but edited web.config with the same failure results.

I've been through every IIS setting and they all look identical.
All the wwwroot folder permissions seem the same on the servers that work and those that don't.
I'm using a custom app pool that looks identical on both sets.

Procmon says that it is trying to access the C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\CSharp.dll as NT AUTHORITY\IUSR and getting BAD IMPERSONATION.
I'm hesitant to install procmon on a production server, so I can't compare the results there. But I can see that NT AUTHORITY\IUSR does NOT have effective access to that file on the servers that are working.


Even though I had impersonate set to true on the working servers, setting it to false allowed the new servers to start working.

    <identity impersonate="false" />
    <compilation targetFramework="4.5" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.