簡體   English   中英

找不到Coldfusion REST服務錯誤

[英]Coldfusion REST service not found error

我在調用REST服務時遇到問題。 它總是返回NOT FOUND錯誤。

REST服務已在CF管理員中注冊:

  • 根路徑:D:\\ projects \\ testcf11 \\ restfolder
  • 主機:testcf11.localhost
  • 服務映射:testrest

在/ 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM