我在 Windows 2008 R2(64 位)上使用 CF10(64 位)(开发者版?)
我正在尝试实现这个非常基本的教程:
http://blogs.coldfusion.com/post.cfm/rest-support-in-coldfusion-part-i
我通过 IIS 在端口 8081 上创建了一个新网站,然后添加了两个文件:
/index.cfm(理论上,因为不需要包含应用程序变量的 application.cfc,我可以跳过这个)
<cfset s = "Hello World!">
<cfoutput>#s#</cfoutput>
/RestExample/HelloWorld.cfc
<cfcomponent rest="true" restPath="/hello">
<cffunction name="sayHello" access="remote" returnType="String" httpMethod="GET">
<cfset res="Hello World">
<cfreturn res>
</cffunction>
</cfcomponent>
在 CF 管理员中:
C:/websites/test/RestExample/
Example
我收到以下错误:
Error registering REST service. Please ensure that you have entered a proper mapping and path.
Application Example could not be initialized.
Reason: The application does not contain any rest enabled CFCs.
The application does not contain any rest enabled CFCs.
一些系统信息:
Server Product ColdFusion
Version 10,0,8,284032
Tomcat Version 7.0.23.0
Edition Developer
Serial Number Developer
Operating System Windows Server 2008 R2
OS Version 6.1
Update Level /C:/ColdFusion10/cfusion/lib/updates/chf10000008.jar
Adobe Driver Version 4.1 (Build 0001)
JVM Details
Java Version 1.6.0_29
Java Vendor Sun Microsystems Inc.
Java Vendor URL http://java.sun.com/
Java Home C:\ColdFusion10\jre
不确定此时是否是配置问题?这是 related to my previous question ,并试图简化一切以找出原因。
编辑 #1
我能够将这个非常简单的 RESTful 服务添加到 Windows 7 64 位/CF 10(无更新)而没有任何问题。我想知道是我的安装损坏了还是更新损坏了它?
编辑 #2
我重新安装了我的 CF 服务器,它仍然给了我同样的问题。
编辑 #3
根据 milanchandna 的建议,我按照以下步骤操作:
注册 REST 服务时出错。请确保您输入了正确的映射和路径。
应用实例无法初始化。
原因:该应用程序不包含任何启用了休息的 CFC。
该应用程序不包含任何启用了休息的 CFC。
Hello World .cfc:
<cfcomponent rest="true" restPath="/hello">
<cffunction name="sayHello" access="remote" returnType="String" httpMethod="GET">
<cfset res="Hello World">
<cfreturn res>
</cffunction>
</cfcomponent>
最佳答案
我在 C:\ColdFusion10\cfusion\wwwroot(而不是站点的 IIS 根)下创建了文件,并且能够通过管理控制台注册 REST 服务,没有任何问题。
关于web-services - 无法添加最基本的 RESTful Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15204688/