3
我似乎無法讓CF REST工作。 嘗試文檔和一對夫婦的文章一字不差後,我收到了404ColdFusion 11 REST返回404
我使用的Apache - 根據其他職位, JkMountFile「C:/ColdFusion11/config/wsconfig/1/uriworkermap.properties」 可能需要 - 我加了它以防萬一,但這似乎沒有什麼區別。
APACHE VHOST
<VirtualHost *:80>
ServerName 127.0.0.1
ServerAlias 127.0.0.1
DocumentRoot "C:/wwwroot/CFREST2"
ErrorLog "C:/wwwroot/CFREST2/logs/error.log"
CustomLog "C:/wwwroot/CFREST2/logs/access.log" combined
JkMountFile "C:/ColdFusion11/config/wsconfig/1/uriworkermap.properties"
<Directory "C:/wwwroot/CFREST2/logs/">
AllowOverride None
Options None
Order allow,deny
Deny from all
</Directory>
</VirtualHost>
實施例:
CFADMIN - registered
Root path: C:\wwwroot\CFREST2
Host: 127.0.0.1
Service Mapping: test
FILE:(C:\ wwwroot的\ CFREST2 \ rest3.cfc)
<cfcomponent rest="true" restpath="restService" >
<cffunction name="sayHello" access="remote" returntype="String" httpmethod="GET" >
<cfset rest = "Hello World" >
<cfreturn rest >
</cffunction>
MAKING GET請求在郵遞員:
個http://127.0.0.1/rest/test/restService/
返回值:
404
MAKING GET請求郵差:
http://127.0.0.1/rest/test/restService/sayHello
返回值:
404
我已經嘗試了一些變化,緊靠總是得到404 。
在CF管理員REST服務的主機是可選的 - 你確定它應被設置爲127.0 .0.1?你在本地機器上測試它嗎?也許試試把它留空。 嘗試改變restpath =「restService」到restpath =「/ restService」 而且 - 在CF管理 - 數據與服務> REST服務 - 點擊刷新按鈕並檢查它是否正確地刷新 - 應該有一個「服務器已已成功更新「消息。 GET http://127.0.0.1/rest/test/restService應該是正確的路徑。 – Lucas
那麼,我從我的午餐回來後,我的測試文件夾之一開始工作...雖然仍然扔404s 我懷疑服務重啓做了訣竅 - 但我仍然困惑,爲什麼 - 重新啓動服務不是在任何文檔中提到。 這太不一致了,除了路徑解析以及其他一些怪異之外,「休息」會阻止我將CF用於我的REST API。我認爲CF錯過了這條船。 – jpmyob