This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16013|Reply: 1

[ASP.NET] asp.net Website anomaly error analysis

[Copy link]
Posted on 9/13/2017 3:23:25 PM | | | |
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!





Previous:spring.net nhibernate sqldatetime overflow solution
Next:discuz judges that different pages output different content
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com