C# 如何在c中运行带有dll库的exe的Web服务

C# 如何在c中运行带有dll库的exe的Web服务,c#,.net,dll,exe,C#,.net,Dll,Exe,我正在开发一个Web服务。此Web服务执行名为program.exe的.exe。program.exe使用dll库。当我在cmd中运行program.exe时,它运行得非常完美。问题是当我尝试在webservice中执行program.exe时 Process p = new Process(); ProcessStartInfo psi = new ProcessStartInfo(programPath); psi.Argume

我正在开发一个Web服务。此Web服务执行名为program.exe的.exe。program.exe使用dll库。当我在cmd中运行program.exe时,它运行得非常完美。问题是当我尝试在webservice中执行program.exe时

Process p = new Process();
                ProcessStartInfo psi = new ProcessStartInfo(programPath);
                psi.Arguments = "56484864 d:\\ file_kkii.xml";
                p.StartInfo = psi;
                p.Start(); 
在webservice中运行program.exe时,它会正确打开program.exe,但program.exe在尝试使用dll库时失败。问题是:System.TypeInitializationException

我不知道是哪个问题。如果我使用Windows服务器运行program.exe,失败也是一样的

但是如果我使用VisualStudio服务器来证明它,它会运行得非常完美

为什么它在webservice和windowsservice中不起作用?我需要一些使用dll的权限吗


谢谢大家

你的DLL和你的程序.exe在同一个文件夹中吗?我刚刚删除了另一个