簡體   English   中英

ColdFusion 11 REST 返回 404

[英]ColdFusion 11 REST returning 404

我似乎根本無法讓 CF REST 工作。 在逐字嘗試文檔和幾篇文章后,我得到了 404。

我正在使用 apache - 根據其他帖子,可能需要 JkMountFile "C:/ColdFusion11/config/wsconfig/1/uriworkermap.properties" - 我添加了它以防萬一,但這似乎沒有什么區別。

阿帕奇虛擬主機

<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>

在郵遞員中發出請求:

http://127.0.0.1/rest/test/restService/

退貨:

404

在郵遞員中發出請求:

http://127.0.0.1/rest/test/restService/sayHello

退貨:

404

我嘗試了一些變體,但總是得到 404。

FWIW,在提出這個問題 4 年多之后,我已經有一段時間沒有使用 CF,我正在嘗試通過設置 RESTful 服務來工作。

我收到了 404,並在我的 exception.log 中看到了這一點:

java.io.FileNotFoundException: .../cfusion/wwwroot/WEB-INF/rest-skeletons/path.to.component.Fubar.class(權限被拒絕)

我檢查過,運行該服務的帳戶無權寫入“rest-skeletons”目錄。 我改變了,不再是 404,到下一個問題!

嘗試通過在單獨的.cfm文件中運行它來初始化:

<cfset restInitApplication("C:\wwwroot\CFREST2","test")>

致電: http//127.0.0.1/rest/test/restService

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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