我在使用 CF10(64 位)(开发版?)的 Windows 2008 R2(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
不确定此时是否是配置问题?这与我之前的问题有关,并试图简化一切以隔离原因。
编辑 #1 我能够将这个非常简单的 RESTful 服务添加到 Windows 7 64 位/CF 10(无更新),没有任何问题。我想知道是我的安装损坏还是更新损坏了它?
编辑 #2 我重新安装了我的 CF 服务器,但它仍然给了我同样的问题。
编辑#3
根据 milanchandna 的建议,我按照以下步骤操作:
- 创建了一个文件夹 c:\websites\milanchandna
- 在 IIS 中创建了一个新网站(milanchandna 使用同名的 apppool)并使用 c:\websites\milanchandna 作为 root,在端口 8084 上运行
- 创建了 jakarta 虚拟目录(需要这个)
- 添加了基本的 HelloWorld.cfc
- 成功导航到 HelloWorld.cfc,没有错误
- 在 CF Admin、REST Services 中,添加了以下内容:
- 根路径:C:/websites/milanchandna/
- 服务映射:示例
- 点击添加服务
- 获取错误:注册 REST 服务时出错。请确保您输入了正确的映射和路径。无法初始化应用程序示例。原因:应用程序不包含任何启用了休息的 CFC。该应用程序不包含任何启用了 REST 的 CFC。
HelloWorld.cfc:
<cfcomponent rest="true" restPath="/hello">
<cffunction name="sayHello" access="remote" returnType="String" httpMethod="GET">
<cfset res="Hello World">
<cfreturn res>
</cffunction>
</cfcomponent>