本文介绍了CFExecute不执行appcmd.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Cofdfusion服务器上创建了以下代码:文件名:testWebsite.cfm

I created the following code on a Cofdfusion server: file name: testWebsite.cfm

<cfoutput>
<cfset exec_command = "add site /name:""demosite"" /bindings:http://demosite.testserver.com:80 /physicalpath:""D:\Websites\demosite"" ">

<cfexecute name="C:\Windows\System32\inetsrv\appcmd.exe" arguments="#exec_command#" timeout="60" />

Done!
</cfoutput>

但是当我执行此文件时,例如 http://www.demoserver.com/testcases/testWebsite.cfm

But when I execute this file e.g. http://www.demoserver.com/testcases/testWebsite.cfm

它仅显示完成!"没有任何错误,它不会执行添加网站代码.

It just displays "Done!" without any errors, it doesn't execute the add site code.

在引用大量文档时,我检查了执行两个文档的用户权限. coldfusion服务以名为 [email protected] 的域用户身份运行我不知道如何检查IIS.因此,我检查了 World Wide Publishing服务 IIS Admin Service -作为本地系统运行.

Upon referring numerous documents, I checked the user rights under which both execute.The coldfusion service is running as a domain user called [email protected]I don't know how to check the same for IIS.So I checked the World Wide Publishing Service and IIS Admin Service - running as Local System.

即使以管理员身份登录,也无法将 web服务器用户添加到位于以下位置的 inetsrv 文件夹或 appcmd.exe C:\ Windows \ System32

Even if I log in as the administrator, I cannot add the webserver user to the inetsrv folder or the appcmd.exe located at C:\Windows\System32

请帮助您提出任何想法/建议.

Please help with any ideas/suggestions.

谢谢.

推荐答案

如果从cmd.exe调用了appcmd.exe,它将正常工作:

If appcmd.exe is called from cmd.exe it should work:

<cfset vcCmdPath = "C:\Windows\system32\cmd.exe">
<cfset vcAppCmdArg = "/c C:\Windows\System32\inetsrv\appcmd.exe">
<cfset exec_command = "add site /name:""demosite"" /bindings:http://demosite.testserver.com:80 /physicalpath:""D:\Websites\demosite"" ">

<cfexecute name="#vcCmdPath#" arguments="#vcAppCmdArg# #exec_command#" variable="vcAppCmdResults" timeout="60"></cfexecute>

<cfoutput>#vcAppCmdResults#</cfoutput>

我更喜欢对cmd.exe和appcmd.exe使用变量.

I prefer to use variables for cmd.exe and appcmd.exe.

这篇关于CFExecute不执行appcmd.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 17:16