让我们看一下场景,我开发了一个显示.xml
文件列表的Web应用程序(ASP.NET MVC),我们选择了两个.xml
文件进行比较,并使用比较实用程序,如Beyond Compare 3。 / p>
基本上,我有一个在System.Diagnostic.Process
上运行的Scrapt文件(Beyond Compare 3 Script),并根据脚本生成不同的报告文件。我想在显示运行时生成的差异报告的过程中使用该脚本。当我从Visual Studio运行应用程序时,它运行完美并显示预期的差异文件,但是当我在IIS Web服务器上部署此应用程序时,它不会生成差异文件,只是将输入文件显示为输出文件。
以下是启动过程并生成Beyond Compare结果文件作为输出文件的方法。但是下面的代码在Visual Studio开发服务器上运行,但它不适用于IIS(IIS服务器上的网站部署)。
public string GenerateSortedXMLFile(string inputfilepath)
{
string outputfile, inputfile, BCompare, Script;
inputfile = inputfilepath;
outputfile = ConfigurationManager.AppSettings["MFxmlSortFilePath"];
outputfile = outputfile + System.Guid.NewGuid().ToString() + ".txt";
BCompare = ConfigurationManager.AppSettings["BCompareExe"];
Script = ConfigurationManager.AppSettings["Script"];
Process p = new Process
{
StartInfo =
{
FileName = "\"" + BCompare + "\"",
Arguments = " " + "\"" + "@" + Script + "\"" + " " + "\"" + inputfile + "\"" + " " + "\"" + outputfile + "\" /grant BUILTIN\\Users:IIS_IUSRS"
}
};
p.Start();
p.WaitForExit();
p.Close();
return outputfile;
}
答案 0 :(得分:0)
您不能只在网络服务器上运行流程。当然,您可以在开发机器上执行此操作,因为您必须拥有更多权限。
请点击此链接,它必须对您有用。它引导CGI程序注册,权限授予并在启用IIS的Web服务器上运行。
答案 1 :(得分:0)
我不太确定,但我认为在Stackoverflow上提出了一个类似问题。
如果CGI程序(如Tigran所指出的)不是您的选择(出于任何原因) 你有两个选择:
希望,这有帮助。