Skip navigation
gtheilman
Currently Being Moderated

HTTP DELETE requests "hanging" when accessing a cfc (but not cfm)

Nov 21, 2012 8:42 AM

I have what appears to be a configuration problem with Coldfusion 10 running on a Windows server with IIS 7.5

 

I have a javascript function that is sending REST requests to the server.   I am able to make GET, POST,and PUT  HTTP  requests to a REST CFC with no problems.

 

However, when I send an HTTP  DELETE request to the CFC, the code within the delete function in the CFC executes (the delete query in the function runs), but then I don't get a status code sent back to the browser.   It's not that I get an error status code . . . I get NOTHING.   No status code is returned at all and the request process in the browser just sits there and waits.

 

Since the code within the function is working, I've tried "forcing" the return of a status code using cfheader.   It doesn't work.

 

However, if I take the query from the CFC and put it in a file with a CFM extension and call it using the HTTP DELETE method ...I get a 203 status code back right away indicating that the deletion was successful.

 

Running the same process on a local development server has no problems.   The DELETE request to the CFC works fine.   So, it must be something with the way the production server is configured.

 

So, the chain of events seems to be

 

1)  HTTP DELETE request is made to REST on the production server

2)  Coldfusion successfully finds the CFC and executes the code in the correct function

3)  The status code (failure, success, not found ... whatever) gets "lost" and is never sent back to the browser.

 

The main difference seems to be what extension is on the file name.   It works in a .CFM file but doesn't work when the same code is called from a .CFC file.

 

I've been banging my head against the desk for hours working on this and just don't know where to go from here (other than write some sort of kludge that uses PUT to execute a delete query).  And since the problem seems to be on my production server I'm very nervous about doing "trial and error" settings changes.

 
Replies
  • Currently Being Moderated
    Nov 21, 2012 8:57 AM   in reply to gtheilman

    Not sure if this will help, or not, but have you tried CFFLUSH after the delete command?

     

    ^_^

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 21, 2012 9:23 AM   in reply to gtheilman

    Not sure if this will help either but have you specified any request restrictions in IIS?  In IIS go to your website and click on the Handler Mappings.  You should have one for '*.cfc', '*.cfm', etc.  Double-click your cfc handler '*.cfc' and it should open the Edit Script Map dialog.  That has a Request Restrictions... button on it.  Click that button and you get the Request Restrictions dialog.  Click on the Verbs tab and see how it is configured.  Compare that one to your cfm handler '*.cfm'.  Any differences?

     

    sample.jpg

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 21, 2012 10:43 AM   in reply to gtheilman

    Have you tried monitoring the traffic with something like Fiddler (or something similar)? 

    What status codes/returns do you see?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 21, 2012 11:35 AM   in reply to gtheilman

    Since this is happening when calling a cfc, what do you have the returnType set to in your cfc?  And what are you returning from it (if anything)?

     

    Can you share your cfc's relevant code (including the function declaration)?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 21, 2012 11:58 AM   in reply to gtheilman

    To be fair, I have not written any cfc's using the new CF10 attributes 'httpMethod', 'produces' or 'restpath'.  So if I am reading it correctly, you are specifying that the function produces JSON and has a returntype of any but you do not specify a cfreturn.  Have you played around with adding cfreturn and some value?  Or changing the returntype to "void" and just adding <cfreturn /> ?

     

    Admittedly I am guessing at things here...

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 21, 2012 12:20 PM   in reply to gtheilman

    Is anything being written to the logs?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 21, 2012 6:46 PM   in reply to gtheilman

    Well that’s interesting if you don’t see any indication of the delete request in the IIS logs (while you do see it for the other methods).

     

    So here are a couple of thoughts.

     

    - are both your local dev and the remote prod server the same release of CF 10 (same updater level)? You can check in the CF Admin “system information” page (the “I” icon in the top right corner), where it will say 10,0,x where the x will reflect what updater has been added. There could be differences between your two machines that may have an effect

    - since you say there is no request logged in the IIS logs (on prod), that makes me think that that the app pool is crashing when the request is made. Have you applied updater 4 or 5 in prod? Those each address issues that could lead to the IIS app pool crashing. Have you looked in the Windows Event Viewer to perhaps confirm?

    - I’ll assume that CF is not itself crashing on that delete request. Are you doing anything to confirm that? I realize you say you see some output that you are creating, but it could do that before CF might crash, I suppose. Just worth checking.

     

    - finally, you mention using IIS on the prod machine. What about on Dev? You don’t say, and while we could assume you have it setup also as IIS, you could also be using the built-in web server (port 8500). If you are using IIS on Dev, is it also IIS 7? And might it be in IIS 6 compatibility mode, where the prod box may not be?

     

    Hope some of that may help.

     

    /charlie

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 22, 2012 5:13 AM   in reply to gtheilman

    Charlie the other odd thing here is that the request actually makes it to the cfc and the cfc executes its code successfully. The only missing piece as I understand it is that no return value is sent.

     

    Right Gary?  Although the only difference between the environments  does seem to be IIS.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 22, 2012 5:16 AM   in reply to gtheilman

    Another thought, (I can't verify right now) are those request restrictions available to the isapimodule itself in IIS?  Similar to my previous post for the cfc handler.

     

    (Sent from mobile device)

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 22, 2012 1:32 PM   in reply to gtheilman

    Yes, you could run both at once. And it may well be a work-around, but I do hope ultimately that you might solve the problem. I can’t think of anything else for now.

     

     

     

    /charlie

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 23, 2012 4:46 AM   in reply to gtheilman

    A follow-up edit, with a simplified question. How do you define the cfcomponent tag? In particular, what are the values of the attributes rest and restPath?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points