我在IIS,Windows Server 2008 R2中使用具有NETWORK SERVICE Identity的AppPool .NET 4.0託管Wcf服務。WCF服務Process.Start在網絡服務帳戶下以不同用戶身份扮演
我的Wcf服務有一個使用Process.Start調用命令EXE的方法。
我需要使用不同的用戶作爲執行命令EXE(域用戶帳戶)的憑據。
我嘗試執行它,但它不適用於我:它似乎不執行命令EXE。
更新:過程退出,但不執行代碼
我得到這樣的錯誤:
退出代碼-1073741502
和EVENTVWR:
Process Information:
Process ID: 0xc50
Process Name: C:\DeployTools\DeployTools.Commands.Ejecutar.exe
Exit Status: 0xc0000142
的參加辦法無法正確啓動(0xC0000142)。點擊確定 關閉應用程序
有什麼建議嗎?
代碼:
StreamReader sr = null;
StreamReader serr = null;
try
{
var psi = new ProcessStartInfo(MY_COMMAND_EXE);
psi.WorkingDirectory = Path.GetDirectoryName(MY_COMMAND_EXE);
psi.Arguments = arguments;
psi.Domain = DOMAIN;
psi.UserName = USER_IN_DOMAIN;
psi.Password = SecureStringHelper.ToSecureString(pwd);
psi.LoadUserProfile = true;
psi.UseShellExecute = false;
psi.ErrorDialog = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Minimized;
using (Process pr = Process.Start(psi))
{
sr = pr.StandardOutput;
serr = pr.StandardError;
if (!pr.HasExited)
{
pr.WaitForExit(300000);
}
output = pr.StandardOutput.ReadToEnd();
errors = pr.StandardError.ReadToEnd();
exitCode = pr.ExitCode;
return output;
}
}
catch (Exception exc)
{
return "EXCEPCIÓN: " + exc.Message;
}
finally
{
if (sr != null)
{
sr.Close();
sr.Dispose();
sr = null;
}
if (serr != null)
{
serr.Close();
serr.Dispose();
serr = null;
}
}
你可以檢查喲您的事件日誌大小,因爲退出代碼'1502'的最後4位數表示事件日誌/錯誤日誌文件已滿。如果這是您可以解決的問題 - http://www.howtogeek.com/howto/windows/fixing-the-event-log-is-full-error-on-windows-xp/ –
這不是問題。我檢查事件日誌,是空的。每次測試前清除日誌。 – Kiquenet
程序集'AsproLock'有一個很強的名字? 程序集生成失敗 - 引用程序集「AsproLock」沒有強名稱\t https://github.com/cloudfoundry-incubator/if_warden/tree/master/lib/AsproLock – Kiquenet