Loading this assembly would produce a different grant set from other instances
The other day one of our legacy applications threw this strange error during a production deploy:
"Loading this assembly would produce a different grant set from other instances"
This .NET 4.6 application is a load balanced SOAP API and strangely this only occured on 1 of the 3 frontend servers so when browsing the frontend it initially seems healty but every other random request would fail and show this error.
(This deploy was extremely small, is was just an update in a documentation file and so it most likely did not trigger an app restart.)
So as always my go to when troubleshooting these kind of issues is doing a IISRESET and not surprisingly this solved my problem. At first I thought I wouldn't mention this but then a friend mentioned that they had the exact same issue, on a different legacy application, on a different server recently so it seems this might be a new recurring issue with legacy applications on newer versions of Windows Server. I found very little help when searching this issue online, hence this blogpost. Hope it might help someone.
Disclaimer: Doing an IISRESET is not the solution to the underlying issue, but by including this in our deploy steps will at least prevent this issue in the future or until we find the underlying cause of this issue.
Cheers friends! ❤️