【发布时间】:2014-01-10 12:10:28
【问题描述】:
我创建了一个 WebApi 项目,我在其中调用了一个 exe,即 Latlong2XY.exe,它将输入文件和输出文件作为参数。并返回我一个 .txt 作为输出文件。当我从 VS2012 IDE 执行应用程序时,它成功创建了所需的 txt 文件。但是,当我在 IIS 中发布相同的应用程序并运行它时,它无法创建 txt 文件。
似乎 IIS Express 正在创建 txt 文件,而 IIS 没有。
这似乎是一些权限问题。但不知道该怎么做。 我的代码是:
int exitCode;
// Prepare the process to run
ProcessStartInfo start = new ProcessStartInfo();
// Enter in the command line arguments, everything you would enter after the executable name itself
start.Arguments = @"D:\RFD\InputFile.txt D:\RFD\Results.txt";
// Enter the executable to run, including the complete path
start.FileName = @"D:\RFD\Latlong2XY.exe";
// Do you want to show a console window?
start.WindowStyle = ProcessWindowStyle.Hidden;
start.CreateNoWindow = true;
// Run the external process & wait for it to finish
using (Process proc = Process.Start(start))
{
proc.WaitForExit();
// Retrieve the app's exit code
exitCode = proc.ExitCode;
}
IIS 设置为:
Windows 身份验证:禁用; 表单身份验证:禁用; 匿名身份验证:启用; .Net 模拟:已禁用。
我正在使用 ASP.NET v4.0 应用程序池。
【问题讨论】:
-
@sudhakar-tillapudi 也看看上面的链接。这也有助于解决问题。
标签: c# asp.net iis file-permissions iis-express