程序在服务器上运行就会出错:系统找不到指定的文件
做了一个加密函数
//加密 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); }