Coldfusion REST 服务未找到错误

Coldfusion REST service not found error

我在调用 REST 服务时遇到问题。它总是 returns 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#" />

软件:Windows8.1、Apache 2.4、CF 11 开发版

感谢任何想法

编辑 1:

我在主机文件中有一个条目。

127.0.0.1 testcf11.localhost

问题似乎与 hostname 有关。您是否在 hosts 文件中输入了 testcf11.localhost?尝试添加它,它可能会解决问题。 hosts 文件位于 %windir%\system32\drivers\etc 内。编辑文件并创建与此类似的条目。

127.0.0.1    testcf11.localhost

输入后您可能需要重新启动系统。 我在我的系统上检查过它,它可以工作。

问题出在端口上。如果其余URL包含端口8500,则一切正常。