Hi all-
Just spent 4 hours struggling with this problem, including 2 hours after finding this thread; then another 3.5 hours on top of that, on the phone with MS Tech Support.
I thought I would share what I learned, which includes another workaround.
The workarounds suggested above were not an option for me for various reasons, and I was not using impersonation. My particular web application required a custom Security.Principal.
So, the upshot, after 3 and a half hours with the MS Tech connected remotely to my dev PC, was this:
Take the custom Security.Principal class out of the website project, and compile it as a Class library into a .DLL (assembly). Sign the .DLL with a Strong Name, and place it in the GAC. Adjust your code that references the custom Principal to call the code in its new location, if necessary- I wound up adding a Reference to the new assembly in my website project. No more problem!
A side note: if you use a WebSetup project to install your website, as I did, you can have it place the assembly into the server's GAC for you, during the installation.
There is apparently something about moving the code that deals with the IIdentity out of the main project (out of the process?), that avoids the issue.
I thought this might help someone else struggling with this issue. There is NOTHING on the web about this issue other than this thread!
Hope this helps someone,
-Andrew
Please remember when your post is solved, to "Mark as Answer" the post(s) that solved it!