IIS7 不会通过 Process Start 启动我的 Exe 文件

IIS7 does not start my Exe file by Process Start(IIS7 不会通过 Process Start 启动我的 Exe 文件)
本文介绍了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:

  1. 缺少 IIS 用户权限,例如应用程序池用户或网络服务(在 IIS6 中).
  2. x86 EXE 在 x64 机器上运行的问题.
  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 不会通过 Process Start 启动我的 Exe 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)