我在Cofd聚变服务器上创建了以下代码:文件名: 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
它只显示“完成!”没有任何错误,它不会执行添加站点代码。
在查阅了许多文档之后,我检查了它们执行时的用户权限。IIS作为一个名为Webserver@domain.com的域用户运行着coldfusion服务,我不知道如何检查相同的IIS。因此,我检查了环球发布服务和IIS管理服务-作为本地系统运行。
即使我以管理员身份登录,也不能将webserver用户添加到位于C:\Windows\System32 32的inetsrv文件夹或appcmd.exe中。
请帮助提出任何想法/建议。
谢谢。
发布于 2011-12-13 06:05:25
如果appcmd.exe是从cmd.exe调用的,那么它应该可以工作:
<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使用变量。
https://stackoverflow.com/questions/8438342
复制相似问题