Une exception non prise en charge s’est produite et la procédure a été interrompue.
ID d’application : /LM/W3SVC/2/ROOT
ID de processus : 6928
Exception: System.Security.Cryptography.CryptographicException
Message: 系统找不到指定的路径。
StackTrace: 在 System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr) En System.Security.Cryptography.SafeKeyHandle._FreeHKey (IntPtr pKeyCtx) Dans System.Security.Cryptography.SafeKeyHandle.ReleaseHandle() at System.Runtime.InteropServices.SafeHandle.InternalFinalize() at System.Runtime.InteropServices.SafeHandle.Dispose(Élimination booléenne) at System.Runtime.InteropServices.SafeHandle.Finalize()
Il existe de nombreux sites web sur IIS, qui sait lequel propose l’anomalie ??? Ne dis-le pas clairement, irritable
ID Application : /LM/W3SVC/2/ROOT Ceci devrait être le site où la ville indique que l’erreur est signalée, mais qui sait ce que cela signifie
/LM/W3SVC/1/Root 里面各项都代表什么?
LM --- nom du serveur local Serveur W3SVC ---- IIS 1---- Sites web avec identifiant site 1 Racine--- racine du site
Ce passage est encore quelque chose que j’ai trouvé sur Internet, et je l’ai légèrement modifié, le journal d’erreur « Application ID : /LM/W3SVC/2/ROOT », c’est-à-dire l’erreur causée par le site web avec l’ID de site 2
ou exécuter
Nous pouvons consulter les informations pertinentes sur le site web
J’ai découvert où était l’erreur, puis j’ai commencé à la corriger...
Lors du débogage local ou de la publication dans l’IIS local, le chiffrement et le déchiffrement fonctionnent bien, mais lorsqu’un service est publié sur un serveur distant, l’erreur suivante s’affiche lors du déchiffrement :
System.Security.Cryptography.CryptographicException:系统找不到指定的文件。
Dans Util.Security.RSAUtils.decrypt(String encryptData,String privateKey) à l’emplacement D :\documents\visual studio2010\Projects\MSPJK\MSPJK\RSAUtils.cs : ligne numéro 175
In MSPJK.DAO.DAO.login(loginInfo loginInfo) emplacement D :\documents\visualstudio 2010\Projects\MSPJK\MSPJK\DAO.cs : numéro de ligne 2052
Après avoir trouvé beaucoup d’informations, c’était résolu. La solution est la suivante :
Entrez le code :
RSACryptoServiceProvider provider = new RSACryptoServiceProvider() ; Modifié en :
CspParameters RSAParams = nouveaux CspParameters() ; RSAParams.Flags = CspProviderFlags.UseMachineKeyStore ; System.Security.Cryptography.RSACryptoServiceProvider provider = new RSACryptoServiceProvider(1024, RSAParams) ; Testez encore, d’accord !
|