加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp-classic – 无法在IIS 7.5上运行来自经典ASP脚本的exe

发布时间:2020-12-15 22:35:25 所属栏目:asp.Net 来源:网络整理
导读:我正在尝试将现有系统从 Windows XP Professional / IIS 5.1升级到Windows 7旗舰版(32位)/ IIS 7.5.原始系统运行了一个经典的ASP网站(仅适用于localhost),该网站使用“ASPExec”在本地计算机上启动桌面应用程序(.bat,.cmd,.exe等).在Windows 7 Ultimate / II
我正在尝试将现有系统从 Windows XP Professional / IIS 5.1升级到Windows 7旗舰版(32位)/ IIS 7.5.原始系统运行了一个经典的ASP网站(仅适用于localhost),该网站使用“ASPExec”在本地计算机上启动桌面应用程序(.bat,.cmd,.exe等).在Windows 7 Ultimate / IIS 7.5下,应用程序无法从ASP页面启动.

作为测试(最终目标不是启动记事本),我尝试过:

<% 
Set Executor = Server.CreateObject("ASPExec.Execute")
Executor.Application = "notepad.exe"
Executor.ShowWindow = True
strResult = Executor.ExecuteWinApp
%>

我也尝试过:

<%
Set wshell = CreateObject("WScript.Shell")
wshell.run "notepad.exe"
Set wshell = Nothing
%>

这两种方法都会导致notepad.exe显示在Windows进程列表中,但无法在桌面上启动应用程序.对于我尝试运行的任何.exe都是如此,而.bat或.cmd文件根本无法执行任何操作.

在IIS 5.1中,ASP应用程序的原始作者使用“IIS Admin”服务和“World Wide Web Publishing”服务上的“允许服务与桌面交互”选项来实现此功能.除了允许桌面交互式服务之外的所有问题,IIS 7不再使用“IIS Admin”服务,因此这不是一个选项.

我正在寻找Windows / IIS方面的解决方法或ASP中的其他选项,可能会产生相同的期望的最终结果.

解决方法

您将无法使用Windows 7 / IIS 7.5执行此操作.这工作的原因是因为您运行的是IIS5.1.回到IIS5.0 / 5.1时代,您有三种不同的流程模型:

>进程中(或低隔离模式) – 每个站点都在inetinfo.exe进程内运行
>池化进程 – 站点在COM内部的外部代理进程中运行
>进程外(或高隔离模式) – 每个站点在其自己的COM进程内运行

很可能您的IIS5.1实例配置为在“进程中”模式和SYSTEM帐户下运行.因为您可以将IIS服务配置为与桌面交互,并且因为您的Classic ASP脚本正在此过程中执行,所以它能够启动可执行文件并显示在桌面上.

在IIS7中,生活是不同的.您的代码将在应用程序池进程中运行,该进程根据需要进行旋转.无法配置池进程(w3wp.exe)并允许它们与桌面交互,即使在本地系统帐户下运行也是如此.

与IIS6不同,您无法将IIS7配置为像IIS5一样运行; IIS7是一个自下而上重写的新架构.

一种可能的解决方法是使用HTTP端点编写简单的WCF服务,该端点在用户登录时启动(托管在隐藏或最小化自身到通知区域的Windows应用程序中).然后,您可以使用类似MSXML2.ServerXMLHttp的内容从Classic ASP代码调用此服务,并获取WCF服务以代表您启动这些进程.

这个Keith Brown的“The .NET Developers Guide to Windows Security”第29章的存档副本解释了使服务应用程序与桌面交互所涉及的阴谋:

07001 (source: archive.org)

引用:

Option one is to get yourself into the interactive window station,and
option two is to have a process already in the interactive window
station display a UI for you.

An easy way to put a daemon in the interactive window station
(WinSta0) so it can have its own user interface is to package it as a
service that runs as SYSTEM and check the box that says,“Allow
service to interact with the desktop.” This tells the SCM to launch
your service process in the SYSTEM logon session (WhatIsALogonSession)
and to attach your process to WinSta0 instead of the noninteractive
window station in which the SYSTEM daemons normally run,
Service-0x0-0x3e7$.

这是你可能已经在你的XP盒子上.但正如我所解释的那样,没有办法配置工作进程来执行此操作,因为您无法配置“允许服务与桌面交互”.即使您可以将池配置为作为本地SYSTEM帐户运行.书写的时候,这适用于Windows 2000/2003.随着Windows Vista / 2008及更高版本的出现,您可以获得UAC的额外复杂性并且也可以通过它.

What you should consider instead is option two: Use two processes
instead of just one. One process must be launched in the interactive
user’s logon session and WinSta0. It should contain all the user
interface elements you need,and it can connect to your daemon process
using any secure form of interprocess communication you’re comfortable
with

这基本上就是我的建议.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读