Cannot register REST services

2019-08-17 05:08发布

问题:

I try to register a directory as a REST app in my CFIDE administrator:

Error registering REST service. Please ensure that you have entered a proper mapping and path. Application servizi could not be initialized. Reason: The application does not contain any rest enabled CFCs. The application does not contain any rest enabled CFCs.

My directory contains:

Application.cfc

component output="false"
{
    this.name = "otticanet-rest";
    this.applicationTimeout = createTimespan(0,1,0,0);
    this.datasource = "svvv";

    this.restsettings.skipCFCWithError = true;

    public boolean function onRequestStart()
    {       
        return true;
    }
}

Product.cfc

<cfcomponent rest="true" restpath="occhiali">

    <cffunction name="getByMarchioAndTipo"
                access="remote"
                httpmethod="GET"
                restpath="{idmarchio}/{idtipo}"
                returntype="Struct"
                produces="application/json">

        <cfargument name="marchio" required="true" restargsource="Path" type="numeric" />
        <cfargument name="tipo" required="true" restargsource="Path" type="numeric" />

        <cfreturn LOCAL.s />
    </cffunction>   
...

So what?

In addition, this worked a month ago. What can be happened?

回答1:

If skipCFCWithError is true and there is some problem in only CFC present in that directory then it shows this error.
Probably you might have changed something in this CFC and its not working now.
Try to access your CFC in browser just as you access any CFM.
That will tell you if there is a problem in your CFC or not.

If there is a problem then fix it and try again.