如何使用WScript.Shell对象调试ASP权限问题? [英] How to debug ASP permission problems with WScript.Shell object?
问题描述
我必须从某些旧版ASP应用程序运行命令行操作.
I have to run command line operation from some legacy ASP application.
这是我的代码:
<%
cmd = "%comspec% /c echo Hello"
set wsh = CreateObject("WScript.Shell")
ireturn = wsh.Run(cmd, 0, true)
set wsh = nothing
%>
这是我收到的结果:
Microsoft VBScript运行时错误 '800a0046'
Microsoft VBScript runtime error '800a0046'
权限被拒绝
/test.asp,第6行
/test.asp, line 6
您是否知道如何使IIS6运行此代码?
Do you have any idea how to make IIS6 to run this code?
注意:当然,我不必运行echo命令,但我想排除此问题的任何其他原因.
更新:我尝试了大多数tomalaks提及的内容,但是没有任何帮助.也许我可以稍微改变一下问题. 如何调试此问题?
Update: I tried most things tomalaks mention however nothing helped. Maybe I can alter question a little. How can I debug this problem?
推荐答案
ASP通常被拒绝访问任何潜在危险的文件,例如cmd.exe.在cmd.exe上检查文件权限,看是否对您来说正确(我想是).
ASP usually is denied access to anything potentially dangerous, such as cmd.exe. Check file permissions on cmd.exe to see if that is true for you (I suppose it is).
如果您真的必须使用cmd.exe来执行部分页面处理,请更改cmd.exe的文件权限(不建议使用面向Internet的Web服务器),或者确保该ASP页运行的凭据不会被拒绝访问该文件.
If you really must use cmd.exe to do part of the page processing, either change file permissions on cmd.exe (not recommended for an Internet-facing web-server), or make sure that the ASP page runs credentials that are not denied access to that file.
要实现此目的,请使用IIS管理控制台删除对ASP页的匿名访问",并改用Windows集成身份验证(如果可行),或者保留匿名访问"并输入一组固定的凭据代替默认的"IUSR _...".
To achieve this, use the IIS management console to remove "anonymous access" to the ASP page and use Windows-integrated authentication instead (if feasible), or leave "anonymous access" on and enter a fixed set of credentials that should be used instead of the default "IUSR_...".
或者,如果仅使用cmd.exe来启动向STDOUT输出内容的程序,则可以尝试直接启动该程序,而无需将其包装在cmd.exe调用中.同样,运行ASP页面的用户需要访问该程序的可执行文件.
Alternatively, if you use cmd.exe just to start a program that outputs something to STDOUT, you can try starting the program directly, without wrapping it in a cmd.exe call. Again, the user the ASP page runs under needs access to that program's executable.
这篇关于如何使用WScript.Shell对象调试ASP权限问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!