This is a very wierd issue - any thoughts/help/hints would be greatly appreciated.
Our web app streams PDF files to the browser using the following code
byte [] fileBytes = GetTheFileBytes();
string contentType = "application/pdf";
context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ContentType = contentType;
context.Response.AddHeader("Content-Length", fileBytes.Length.ToString());
context.Response.AddHeader("Content-Type", contentType);
MemoryStream outputStream = new MemoryStream(fileBytes);
outputStream.WriteTo(context.Response.OutputStream);
context.Response.Flush();
Which seems pretty innocuous and works fine in IIS 6 and IIS 7: if the user has a PDF plugin installed (adobe or foxit etc.) then the PDF is displayed in their browser.
However, in IIS 7.5 (Windows 7 and Win 2008 R2), the Foxit plugin hangs in IE and the Adobe plugin hangs in IE and FF. i.e. if I enter
http://iis70Host/application/getPDF.aspx
everything is fine but
http://iis75Host/application/getPDF.aspx
in the same browser hangs.
I am serving up exactly the same PDF file to exactly the same browsers and both web servers are running the app in the 2.0 framework.
I have not yet managed to get a useful error message out of either plugin when they crash.
I am left thinking that IIS 7.5 is corrupting the file somehow (because the client browser and plugin are the same) - but I find it really hard to imagine how the web server could get thins wrong (it is only streaming binary to the client after all).
- Can anyone think of why the behaviour would be different twix IIS 7.0 and 7.5?
- Does anyone know how to get more debug information out of either the Adobe or foxit plugin? (if I could get the reason why they are crashing, then maybe it will give me a clue as to what is going wrong on the server).
- Any other tips for diagnosing the problem?
Follow ups
I have captured the files using wget and they are identical.
I have had a look at the request and response headers using fiddler and they make no explicit mention of "Range" in the response header (or Accept-range in the request header), which lessons the likelihood that this is the multi-part request problem as suggested by mwalker.
I went ahead and installed the MS Hotfix anyway and that did not help the situation (thus I am even more sure that it is not a "multi-part problem").
So I think I am back to begging for more ideas as to what could be going wrong!
Below are the request and response headers that fiddler records when accessing hosts running IIS 7.5, 7.0 and 6
IIS 7.5
GET /eco/dataFile.aspx?data=147098&record=9754 HTTP/1.1
Host: chrisf
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://chrisf/eco/embeddedMedia.aspx?record=9754&search=true
Cookie: CC=test;
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 114340
Content-Type: application/pdf
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
Persistent-Auth: true
X-UA-Compatible: IE=8
Date: Mon, 26 Jul 2010 12:47:46 GMT
IIS 7.0
GET /eco/dataFile.aspx?data=147098&record=9754 HTTP/1.1
Host: chris1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://chrisf/eco/Test1.htm
Cookie: CC=test;
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 114340
Content-Type: application/pdf
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
X-UA-Compatible: IE=8
Date: Mon, 26 Jul 2010 12:17:15 GMT
IIS 6
GET /mi/dataFile.aspx?data=147098&record=9754 HTTP/1.1
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*
Referer: http://mi-dev/mi/embeddedMedia.aspx?record=9754&search=true
Accept-Language: en-GB
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Accept-Encoding: gzip, deflate
Host: mi-dev
Connection: Keep-Alive
Cookie: CC=test;
Authorization: Negotiate YII...
HTTP/1.1 200 OK
Date: Mon, 26 Jul 2010 10:37:47 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
WWW-Authenticate: Negotiate oYGg...
X-AspNet-Version: 2.0.50727
Content-Length: 114340
Cache-Control: private
Content-Type: application/pdf