An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/2/ROOT
Process ID: 6928
Exception: System.Security.Cryptography.CryptographicException
Message: 系统找不到指定的路径。
StackTrace: 在 System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr) In System.Security.Cryptography.SafeKeyHandle._FreeHKey (IntPtr pKeyCtx) In System.Security.Cryptography.SafeKeyHandle.ReleaseHandle() at System.Runtime.InteropServices.SafeHandle.InternalFinalize() at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing) at System.Runtime.InteropServices.SafeHandle.Finalize()
There are many websites on IIS, who knows which website throws the anomaly??? Don't say it clearly, irritable
Application ID: /LM/W3SVC/2/ROOT This should be the website that the city says that the error is reported, but who knows what this means
/LM/W3SVC/1/Root 里面各项都代表什么?
lm --- local server name W3SVC ---- IIS server 1---- Websites with Site Id 1 Root--- site root
This passage is still something I found on the Internet, and I modified it slightly, the error log "Application ID: /LM/W3SVC/2/ROOT", that is, the error caused by the website with site ID 2
or execute
We can see the relevant information on the website
I found out where the mistake was, and then I started to solve it...
When debugging locally or publishing to local IIS, encryption and decryption work fine, but when a service is published to a remote server, the following error is displayed during decryption:
System.Security.Cryptography.CryptographicException:系统找不到指定的文件。
In Util.Security.RSAUtils.decrypt(String encryptData,String privateKey) at location D:\documents\visual studio2010\Projects\MSPJK\MSPJK\RSAUtils.cs: line number 175
In MSPJK.DAO.DAO.login(loginInfo loginInfo) location D:\documents\visualstudio 2010\Projects\MSPJK\MSPJK\DAO.cs: line number 2052
After finding a lot of information, it was solved. The solution is as follows:
Put the code in:
RSACryptoServiceProvider provider = new RSACryptoServiceProvider(); Changed to:
CspParameters RSAParams = new CspParameters(); RSAParams.Flags = CspProviderFlags.UseMachineKeyStore; System.Security.Cryptography.RSACryptoServiceProvider provider = new RSACryptoServiceProvider(1024, RSAParams); Test again, OK!
|