Enabling Coldfusion/Railo errors on IIS 7

BlueDragon and Railo , ColdFusion Add comments

I just did a Railo/Tomcat install on an IIS7 server and thought the whole thing was hosed as I could only get a 500 internal server error. As I was using the viviotech installer I even bugged Jordan Michaels ( great name dude :-) ) for some help.

I didn't imagine for a second it could be my test.cfm file as it only said "hello world", man do I feel silly now.

 

It turns out that everything was working just fine, but IIS7 was actually hiding the errors. Here is what happened.

 

What I had done on the default website was create a new text file, then rename it to test.cfm. Now by default windows hides known file extensions, so what I really did was rename it to test.cfm.txt but as I couldn't see the .txt I didn't realise.

As a result Railo was throwing file not found errors, IIS was hiding it and giving me a "500 internal server error".

 

On my 2nd site I had a working test.cfm file, but there was also an application.cfm which was trying to access a non existent DSN, which was also causing an error, which was also hidden.

 

The setting in IIIS that causes this can be changed as follows. Click images for bigger versions.

 

Open your IIS management console, select the ROOT to change this for all sites, or the site you want to change, and double click "Error Pages".

detail-errors-1

 

Now click on "Edit Feature Settings"

detail-errors-2

 

In the following dialog box change it to "detailed errors". The default setting only shows the errors locally on the server.

detail-errors-3

 

 

 

Thanks to Jordan Michaels for trying to help me resolve a non existent problem with his installer.

Although I did discover a problem with the FusionReactor instll at the same time :-)

 

Note that this issue effects ColdFusion and Railo or indeed any application server, all errors will be hidden by the IIS 7 default setitng above.

9 responses to “Enabling Coldfusion/Railo errors on IIS 7”

  1. Paul Says:
    Well done! I had an application.cfm error trap that was successfully emailing however RAILO insisted on displaying the default 404 or 500 error pages at the same time. Goign in and pointing IIS to the custom RAILO error.cfm page fixed this issue. What a shame the RAILO docs are so lacking... I understand it's Open Source but geez!
  2. Steve Says:
    Thanks for figuring that out! I was going nuts trying to see my errors.
  3. akos Says:
    thanks for this post, very helpful.
    How can we deal with 404 not found errors please, IIS now shows detailed error for any 404 errors and cannot seem to deal with the error using:
    <cferror type="exception"    template="error.cfm"><cferror type="request"    template="error.cfm">
    Any help would be appreciated.
    Thanks
  4. Russ Michaels Says:
    akos, you have only said you are using exception and request error templates, you need to use the missing template handler if you want cf to handle 404 errors. Or you just create a custom 404 template.
  5. akos Says:
    thanks for that, that works well for missing templates but can still see IIS HTTP Error 404.0 - Not Found if it's a missing directory like www.mydomain.com/mydirectory where mydirectory doen't exist, does that need handling from IIS itself?
  6. Russ Michaels Says:
    requesting a non existent folder does not involve coldfusion as you you are not requesting a CFM page. You need to handle that in IIS.
  7. akos Says:
    ok thanks, here's my problem.
    <cferror type="exception" template="error.cfm">
    only works and catches errors if IIS is set as "Detailed Errors" otherwise just displays a 500 at the top same for 404 etc.
    But then if it is set to display Detailed Errors then for 404 error it'll display all detailed bits. What do I need to change in IIS so I can still use <cferror> to catch the errors but also display a friendly message for 404 errors. Hope that makes sense. I'm sure I've overlooked something.
    CHeers
  8. Russ Michaels Says:
    The problem is with using <cferror> that it lets the error occur and then redirects to the error page, so the error code has been sent back to IIS.
    If you want to avoid this then you need to trap the error instead, which you could by using application.cfc instead to do the error handing.

    Otherwise just use the custom errors in IIS and point to your CFM page.
  9. akos Says:
    hi Russ, thought I'd share an update as it turned out that other people didn't know this.
    I set up custom error pages in IIS for 404 and 500 errors to display a message.
    But <cferror> still executes as normal in the 'background' and my error.cfm page called from:
    <cferror type="exception" template="error.cfm"> sends me the email with all the errors.
    Cheers

Leave a Reply

Leave this field empty

Powered by Mango Blog. Design and Icons by N.Design Studio