让我们开发一个场景,我开发了显示.xml
文件列表的Web应用程序(ASP.NET MVC),并且我们选择了两个.xml
文件进行比较,并使用比较实用工具(如Beyond Compare 3)。过程工作人员不在IIS上工作
基本上,我有Scrapt文件(超越比较3脚本),它在System.Diagnostic.Process
上运行,并根据脚本生成差异报告文件。我想在显示运行时生成的差异报告的过程中使用该脚本。当我从Visual Studio运行应用程序时,它运行良好,并显示预期的差异文件,但是当我在IIS Web服务器上部署此应用程序时,它不会生成差异文件,只是将输入文件显示为输出文件。
以下是启动进程并生成超越比较结果文件作为输出文件的方法。但是下面的代码在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;
}