0

我有一个WCF托管在IIS 7.5. 该服务运行良好,除了需要启动批处理文件的部分。用于此操作的服务中的代码是:

            try
            {
                Process p = new Process();
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.FileName = @"\\MyDomain\asp\Masof\App_Data\mish.bat";
                p.Start();
                p.WaitForExit();
                return 1;
            }
            catch (Exception ex)
            {
                return 0;
            }

上面的代码总是返回 1,但是批处理文件永远不会运行(它应该在服务器上进行文本文件操作)。
我试图:
- 删除UseShellExecute
- 将以下内容添加到web.config文件中:

 <authentication mode="Forms" />
 <identity impersonate="true" userName="administrator" password="1234" />

- 将 Web 应用程序的匿名身份验证编辑为特定用户(具有管理员权限)
,但是,上述方法均无效。
另外,有没有办法检查是否是权限问题?我试过搜索事件查看器,但结果是空的。
编辑:不知道它是否有帮助,但是当尝试从服务器运行进程时(开始=>运行...),我The publisher could not be verified在运行之前收到警告。

4

1 回答 1

0

Have you looked at the user profile linked to your application pool? Can you please share under which pool you are running the app and under which account? Does this account have enough provileges to execute? The code seems correct

于 2013-06-24T13:53:45.567 回答