CFExecute not executing appcmd.exe

核能气质少年 提交于 2019-12-24 00:57:51

问题


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>

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.

Upon referring numerous documents, I checked the user rights under which both execute. The coldfusion service is running as a domain user called Webserver@domain.com 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.

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.

Thanks.


回答1:


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>

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



来源:https://stackoverflow.com/questions/8438342/cfexecute-not-executing-appcmd-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!