我似乎根本无法让 CF REST 工作。 在逐字尝试文档和几篇文章后,我得到了 404。
我正在使用 apache - 根据其他帖子, JkMountFile“C:/ColdFusion11/config/wsconfig/1/uriworkermap.properties” 可能需要 - 我添加它只是为了以防万一,但这似乎没有什么区别。
APACHE 虚拟主机
<VirtualHost *:80>
ServerName 127.0.0.1
ServerAlias 127.0.0.1
DocumentRoot "C:/wwwroot/CFREST2"
ErrorLog "C:/wwwroot/CFREST2/logs/error.log"
CustomLog "C:/wwwroot/CFREST2/logs/access.log" combined
JkMountFile "C:/ColdFusion11/config/wsconfig/1/uriworkermap.properties"
<Directory "C:/wwwroot/CFREST2/logs/">
AllowOverride None
Options None
Order allow,deny
Deny from all
</Directory>
</VirtualHost>
示例:
CFADMIN - registered
Root path: C:\wwwroot\CFREST2
Host: 127.0.0.1
Service Mapping: test
文件:(C:\wwwroot\CFREST2\rest3.cfc)
<cfcomponent rest="true" restpath="restService" >
<cffunction name="sayHello" access="remote" returntype="String" httpmethod="GET" >
<cfset rest = "Hello World" >
<cfreturn rest >
</cffunction>
在 postman 中发出获取请求:
http://127.0.0.1/rest/test/restService/
返回:
404
在 postman 中发出获取请求:
http://127.0.0.1/rest/test/restService/sayHello
返回:
404
我尝试了一些变体,但总是得到 404。
最佳答案
FWIW,问题提出已有 4 年多了,我已经有一段时间没有使用 CF 了,我正在尝试通过设置 RESTful 服务来解决这个问题。
我收到了 404,并在我的异常日志中看到了这一点:
java.io.FileNotFoundException: .../cfusion/wwwroot/WEB-INF/rest-skeletons/path.to.component.Fubar.class (Permission denied)
我检查过,运行该服务的帐户没有写入“rest-sculpts”目录的权限。我改变了,不再有 404,继续下一个问题!
关于apache - ColdFusion 11 REST 返回 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41964855/