[英]Coldfusion REST service not found error
我在調用REST服務時遇到問題。 它總是返回NOT FOUND錯誤。
REST服務已在CF管理員中注冊:
在/ restfolder中是一個cf組件:
<cfcomponent rest="true" restpath="Customers">
<cffunction name="getCustomer" restpath="{customerID}" access="remote" returntype="String" httpmethod="GET">
<cfargument name="customerID" required="true" restargsource="Path" type="numeric">
<cfset ret = "Customer ID: " & arguments.customerID>
<cfreturn ret>
</cffunction>
</cfcomponent>
我嘗試使用該代碼:
<cfhttp url="http://testcf11.localhost/rest/testrest/Customers/1" method="get">
</cfhttp>
<cfdump var="#cfhttp#" />
軟件:Windows 8.1,Apache 2.4,CF 11開發人員版
謝謝你的任何想法
EDIT1:
我在主機文件中有一個條目。
127.0.0.1 testcf11.localhost
看來問題與hostname
。 您是否在hosts
文件中輸入了testcf11.localhost
的條目? 嘗試添加它可能會解決問題。 hosts
文件位於%windir%\\system32\\drivers\\etc
。 編輯文件並輸入與此類似的條目。
127.0.0.1 testcf11.localhost
輸入后,您可能需要重新啟動系統。 我在系統上對其進行了檢查,並且可以正常工作。
問題出在港口。 如果其余URL包含端口8500,則一切正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.