Chttpexception 404 Crashes On Iis7

Hi all:

Today I discovered a troublesome problem with my application running under IIS7: when loadModel($id) in a controller doesn’t find a model (thus triggering the CHttpException 404 message) the application crashes with an Yii error that says


You are not authorized to perform this action...

followed by a stack trace that shows the controller filtering methods sequence.

It’s not a PHP error and it only happens under IIS7 because the exact same loadModel() code is used everywhere (under Linux at least) with no problems. I believe the same will happen with any thrown CHttpException so think it’s an IIS7 issue but I don’t know enough about it to fix it.

My question to IIS7 developers is, how do you configure it to handle CHttpExceptions thrown by Yii? Any help will be greatly appreciated.


Upon further testing on other PC’s I had mixed results. The test code was a simple page with:

<?php throw new CHttpException('404','Error'); ?>

  1. On WS2008 with Yii 1.1.13 I got a PHP error about not being able to open a file or stream because of permissions; after I upgraded to Yii 1.1.4 the problem went away.

  2. My development PC at work (where the problem resides) is Win7 using the local IIS7 server. On a different Win7 PC with Yii 1.1.13 and 1.1.4 everything worked fine. ???

I already mentioned the loadModel($id) action in the controller is the standard one created by Gii. Any ideas?