ProtectedData.Unprotect on an IIS application - fails to work after IISRESET

廉价感情. 提交于 2019-12-04 17:38:56

Whilst I don't know why this was happening, I changed the code to use AES encryption instead - this is working fine.

While not an answer to the problem per-say I think it's a valid workaround that deserves mentioning.

EDIT:

I think I've found what was causing the issue (I still don't exactly know WHY this is happening, but I did notice something today).

If the web application is using the ApplicationPool identity, then all is fine and well and DPAPI should continue working after an IISRESET. However if I change the identity to a specific user defined in AD, then things go haywire after the application pool is recycled.

Lucky for me In this particular case I neither need a specific AD user any more and the main encryption is based on AES (DPAPI can't be used to access a shared resource when load balancing comes into the equation) with DPAPI only being used to encrypt the local copy of the AES keys.

I had the exact error when using ASP.NET Core Data Protection API, and for those of you who has this error, please confirm that LoadUserProfile was enabled for the Application Pool User.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!