IIS7 does not start my Exe file by Process Start(IIS7 不会通过 Process Start 启动我的 Exe 文件)
问题描述
我读过很多文章.但据我所知,我已经做了所有.在本地计算机 VS2010 上一切正常.只有在 IIS7 服务器上工作时才会出现此问题.
I've read a lot of articles. But as far as I know I've done all. On local computer VS2010 all works fine. The problem occurs only when working on IIS7 Server.
如果我从 Windows 资源管理器手动启动它,我想启动一个在服务器上运行良好的 exe 文件.
I want to start a exe file which works great on server if I start it manually from Windows Explorer.
Dim fiExe As New IO.FileInfo(IO.Path.Combine(diBase.FullName, "ClientBinConvertAudio.exe"))
Dim SI As New ProcessStartInfo(fiExe.FullName, args)
SI.Verb = "runas"
SI.UseShellExecute = True
SI.WorkingDirectory = fiExe.Directory.FullName
Dim P As Process = Process.Start(SI)
P.PriorityClass = ProcessPriorityClass.Idle
我已经在 IIS 的应用程序中转换了目录 ClientBin
.
I've converted the directory ClientBin
in an Application in IIS.
但在使用服务时我收到此错误(Silverlight 应用程序中的回调):
But when using the service I receive this error (callback in Silverlight application):
{System.Security.SecurityException ---> System.Security.SecurityException: Sicherheitsfehler
bei System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
bei System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
bei System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
--- Ende der internen Ausnahmestapelüberwachung ---
bei System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
bei System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
bei System.Net.WebClient.WebClientWriteStream.<Dispose>b__3(IAsyncResult ar)}
我已尝试存储文件clientaccesspolicy.xml";在同一目录中,如 ClientBin
I've tried to store the file "clientaccesspolicy.xml"
in same directory like ClientBin
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
仍然是相同的消息.有什么想法吗?
Still the same message. Any idea?
*** 新信息 - 动词 ***使用此功能时
*** new info - verb *** When using this function
Dim startInfo As New ProcessStartInfo(fiExe.FullName)
Dim V As String = ""
For Each verb As String In startInfo.Verbs
V &= V & ", "
Next
Throw New Exception("Verbs=" & V)
我收到了这个结果:
动词=, , , , , , , ,
Verbs=, , , , , , ,
*** 找到解决方案 ***我在使用 http://www.fiddler2.com 和 http://technet.microsoft.com/en-us/sysinternals/bb896653问题是在 x64 IIS 上使用 x86 应用程序并结合 verb=runas
标志.现在应用程序设置为anycpu(也许没关系)并且ProcessStartInfo上的verb
没有设置为任何东西.
*** Solution found ***
I've found the solution while using http://www.fiddler2.com and http://technet.microsoft.com/en-us/sysinternals/bb896653
Problem was while using x86 application on a x64 IIS in combination with verb=runas
flag. Now application is set to anycpu (Perhaps that does not matter) and verb
on ProcessStartInfo is not set to anything.
推荐答案
经过长途跋涉,我和Nasenbaer发现了以下内容.IIS 无法运行 EXE 的可能原因是:
After a long journey, me and Nasenbaer have found the following. The possible reasons for IIS to fail run an EXE are:
- 缺少 IIS 用户权限,例如应用程序池用户或网络服务(在 IIS6 中).
- x86 EXE 在 x64 机器上运行的问题.
- 典型的 EXE 失败问题,例如缺少依赖项.
原答案:
您需要在 EXE 所在的目录上为 IIS AppPoolDefaultAppPool
用户分配 FullControl 安全权限.这是尝试运行该进程的用户(假设您正在使用DefaultAppPool
),如果没有适当的权限,它就无法这样做.
You need to assign FullControl security permissions for the IIS AppPoolDefaultAppPool
user, on the directory the EXE is located in. This is the user that is trying to run the process (assuming you are using the DefaultAppPool
), and without the proper permissions, it is unable to do so.
当您手动运行 EXE 时,您使用的是 Windows 登录用户.这就是您可以手动午餐的原因.IIS 使用应用程序池用户.
When you run the EXE manually, you are using the Windows logged in user. This is why you are able to lunch it manualy. The IIS uses the Application Pool user.
要添加权限,只需执行以下操作:
- 转到目录属性
- 安全标签
- 编辑.. -> 添加
IIS AppPoolDefaultAppPool
- 检查
FullControl
截图:
这篇关于IIS7 不会通过 Process Start 启动我的 Exe 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:IIS7 不会通过 Process Start 启动我的 Exe 文件
基础教程推荐
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- c# Math.Sqrt 实现 2022-01-01
- 如何激活MC67中的红灯 2022-01-01