嗨我试图加密使用GPG即时通讯能够从命令行执行的zip。当我将它整合到C#应用程序中时,它运行良好。但是,当我用Windows服务整合它,我得到错误的gpg2.exe关闭从c#运行gpg.exe时出现错误#
以下是异常的详细信息
Problem signature:
Problem Event Name: APPCRASH
Application Name: gpg2.exe
Application Version: 0.0.0.0
Application Timestamp: 4fa14f63
Fault Module Name: StackHash_e51a
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Code: c0000005
Exception Offset: 00000000
OS Version: 6.0.6002.2.2.0.272.7
Locale ID: 1033
Additional Information 1: e51a
Additional Information 2: 4c0d4d78887f76d971d5d00f1f20a433
Additional Information 3: e51a
Additional Information 4: 4c0d4d78887f76d971d5d00f1f20a433
以下是我使用的加密
公共代码布尔加密(串inRecipient,串的资源文件,串destinationFile) {
/// File info
FileInfo fi = new FileInfo(sourceFile);
ProcessStartInfo s = new ProcessStartInfo("cmd.exe");
s.CreateNoWindow = true;
s.UseShellExecute = false;
s.RedirectStandardInput = true;
s.RedirectStandardOutput = true;
s.RedirectStandardError = true;
s.WorkingDirectory = new FileInfo(pgpPath).DirectoryName;
bool processExited = false;
using (Process p = Process.Start(s))
{
string recipient = " --recipient \"" + inRecipient + "\"";
string output = " --output \"" + destinationFile + "\"";
string encrypt = " --encrypt \"" + sourceFile + "\"";
string homedir = " --homedir \"" + HomeDirectory + "\"";
string cmd = "\"" + PgpPath + "\" " + recipient + output + encrypt;
p.StandardInput.WriteLine(cmd);
p.StandardInput.Flush();
p.StandardInput.Close();
processExited = p.WaitForExit(3500);
p.Close();
}
return processExited;
}
我无法找到任何使用问题签名。请帮忙
在此先感谢!
什么是'HomeDirectory',你是否以系统用户身份作为用户运行服务? –