程序在服务器上运行就会出错:系统找不到指定的文件,该如何解决
程序在服务器上运行就会出错:系统找不到指定的文件
做了一个加密函数
在本地的IIS上都没问题,但是上传到服务器上就会出错
提示:
系统找不到指定的文件
在 System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
在 System.Security.Cryptography.DSACryptoServiceProvider.ImportParameters(DSAParameters parameters)
在 System.Security.Cryptography.DSA.FromXmlString(String xmlString)
------解决方案--------------------
把本机的 这个dll 复制到服务器上。
如果 还不行 用system32 注册一下。
做了一个加密函数
- C# code
//加密 public static string Encode(string key) { dsa.FromXmlString(PRIVATE_KEY); System.Security.Cryptography.DSASignatureFormatter f = new System.Security.Cryptography.DSASignatureFormatter(dsa); f.SetHashAlgorithm("SHA1"); Byte[] source = System.Text.ASCIIEncoding.ASCII.GetBytes(key); System.Security.Cryptography.SHA1Managed sha = new System.Security.Cryptography.SHA1Managed(); Byte[] result = sha.ComputeHash(source); Byte[] regkey = f.CreateSignature(result); return Convert.ToBase64String(regkey); }
在本地的IIS上都没问题,但是上传到服务器上就会出错
提示:
系统找不到指定的文件
在 System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
在 System.Security.Cryptography.DSACryptoServiceProvider.ImportParameters(DSAParameters parameters)
在 System.Security.Cryptography.DSA.FromXmlString(String xmlString)
------解决方案--------------------
把本机的 这个dll 复制到服务器上。
如果 还不行 用system32 注册一下。