Web services 从IIS web服务调用控制台应用程序,不加载DLL';s
我的iis服务正在调用控制台应用程序。此控制台应用程序引用DLL 当我检查错误输出时,我得到: 无法加载文件或程序集的file:///c:\windows\system32\inetsrv\MyDll.dll' 调用可执行文件的正确方法是: 到目前为止,我已经尝试过:Web services 从IIS web服务调用控制台应用程序,不加载DLL';s,web-services,iis,shellexecute,Web Services,Iis,Shellexecute,我的iis服务正在调用控制台应用程序。此控制台应用程序引用DLL 当我检查错误输出时,我得到: 无法加载文件或程序集的file:///c:\windows\system32\inetsrv\MyDll.dll' 调用可执行文件的正确方法是: 到目前为止,我已经尝试过: using (var p = new System.Diagnostics.Process()) { p.StartInfo.UseShellExecute = false
using (var p = new System.Diagnostics.Process())
{
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.FileName = downloaderPath;
p.Start();
string o = p.StandardOutput.ReadToEnd();
string i = p.StandardError.ReadToEnd();
p.WaitForExit();
}
添加此行:
p.StartInfo.WorkingDirectory = Path.GetDirectoryName(downloaderPath);
添加以下内容:
p.StartInfo.WorkingDirectory = "c:\mydir\";
如果没有,可执行文件将从运行IIS的目录(c:\windows\system32\inetsrv)启动