IIS7 不通过进程启动启动我的 Exe 文件 [英] IIS7 does not start my Exe file by Process Start

查看:15
本文介绍了IIS7 不通过进程启动启动我的 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.comhttp://technet.microsoft.com/en-us/sysinternals/bb896653问题是在 x64 IIS 上结合 verb=runas 标志使用 x86 应用程序时.现在应用程序设置为 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:

  1. 缺少 IIS 用户的权限,例如应用程序池用户或网络服务(在 IIS6 中).
  2. 在 x64 机器上运行的 x86 EXE 问题.
  3. 典型的 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.

要添加权限,只需执行以下操作:

  1. 转到目录属性
  2. 安全标签
  3. 编辑.. -> 添加IIS AppPoolDefaultAppPool
  4. 检查FullControl

截图:

这篇关于IIS7 不通过进程启动启动我的 Exe 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆