views:

105

answers:

2

I have the strangest problem that I simply cannot solve by myself.

I have this ASP.NET MVC 1 application that works flawelessly on my local development machine, using IIS5.

I made the appropriate changes to get MVC to work on IIS5 by adding a route for .mvc controllers and an aspnet_isapi.dll filter as documented in http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

Now came time to deploy this to Windows Server 2003 with IIS6. I made the exact same changes as described in the document above.

The result is that when I access my MVC view it works in the sense that it does not throw any errors, but the page is blank! I looked for errors in the event log, or IIS web log, nothing.

upon closer inspection, I used "view source" through firefox, and for my blank page on the server here is what I get:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1"><title>

</title>

<style type="text/css">
/*margin and padding on body element
can introduce errors in determining
element position and are not recommended;
we turn them off as a foundation for YUI
CSS treatments. */
body {
margin:0;
padding:0;
}
</style>   

<!--BEGIN: Styles-->   

That's it, the content just gets cut off after <!--BEGIN: Styles-->. When I compare what I get when i "view source" on the same page running on my local machine where it works, all of the above is there, but the diference is that after <!--BEGIN: Styles--> the content continues on with the rest of the HTML such as CSS external includes and Javascript external includes, followed by the <BODY> etc...

I am pulling my hair out over this, has anyone had this problem while deploying an MVC application to IIS6 on Windows Server 2003 ?

+1  A: 

Are there any other ISAPI filters in the website? If there are other applications running in the same app pool as your website, try running it with in a different app pool. Also if you have access to server is you may want to check the Event Log.

iaimtomisbehave
Yep. Checked the event log. nothing there. It is running in its own dedicated application pool... However there are other websites (non mvc) running on the save server, also in their own pools.
Roberto Sebestyen
A: 

I finally found the cause!

As it tuns out, I have some <% code %> that is causing an exception to be thrown in the VIEW. Under normal circumstances the error would show up. However I forgot that I had created a custom HandleErrorAttribute. In this handler I do return the error, except that the error message is being returned in a header value rather than in the HTTP output stream. This handler was written for the purpose of handling errors during AJAX calls. But in this case it was NOT an AJAX call.

Duuh me! I have been going in circles with this untill I put a Try, Catch around the block of code that looked suspicious to me. That is how I discovered that an exception was indeed being thrown, which prompted me to hunt down where the excpetion is being eaten up!

Thanks guys for trying to help!

Roberto Sebestyen