2011-12-08 24 views
2

我創建了一個Cofdfusion服務器上的下面的代碼:文件名:testWebsite.cfmCFExecute不執行Appcmd.exe的

<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

它只是顯示 「完成!」沒有任何錯誤,它不會執行添加站點的代碼。

在參考大量文獻,我查了下,這兩者執行的用戶權限。 coldfusion服務作爲一個域用戶運行,稱爲[email protected] 我不知道如何檢查相同的IIS。 所以我檢查了World Wide Publishing ServiceIIS管理服務 - 作爲本地系統運行。

即使我登錄作爲管理員,我不能Web服務器用戶添加到INETSRV文件夾或Appcmd.exe的位於C:\ Windows \ System32下

請任何幫助/建議的想法。

謝謝。

回答

1

如果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的變量。