嗨我試圖加密使用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',你是否以系統用戶身份作爲用戶運行服務? –