Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intermittent receive failure using mvc webgrid on server only

I am using the System.Web.Helpers.WebGrid extensively throughout our application, and for the most part it is fine and in fact running locally it is always fine or with a self SSL on the server it is also fine. So I don't know if the problem could actually be with IIS or a firewall, or the actual grid, or what I need to do to fix it.

On all browsers, although the result is slightly different, successive ajax sorting and paging on the WebGrid will eventially cause it to hang, and when I inspect the response in Fiddler I get

[Fiddler] ReadResponse() failed: The server did not return a response for this request.

If I copy and paste the url directly into a browser it will load but if I continually hit F5 I will eventually get a message stating "This webpage is not available" in chrome (with Error 103 ERR_CONNECTION_ABORTED) or "Internet Explorer cannot display the webpage" in IE.

The url is quite long and convoluted, something like http://app.myapp.com/mygrid/9e3b2ae5-cbe1-4a4a-a355-a14f00d26e24?mylayout=true&myid=634982439599769687&readonly=False&search=-&__=634982439708207187&sort=Name&dir=ASC

and this problem seems to go away if an SSL certificate is installed on the server, and doesn't happen at all locally.

Any ideas?

like image 799
Adam Avatar asked Mar 07 '13 11:03

Adam


1 Answers

Your last paragraph of your question

and this problem seems to go away if an SSL certificate is installed on the server, and doesn't happen at all locally.

immediately made me think of possible issues with DEFLATE and GZIP problems, knowing they would be disabled on encrypted connection, and quite possibly also for local connections, as you can't really move the same certificate from the server environment to your local development environment (that would beat their purpose), and would have to create a new self-signed certificate for testing purposes, if that was a requirement.

I also happen to have stumbled across infinite loop may occur in GZipStream or DeflateStream issues before with one of previous .NET 4.0, version 4.0.30319.236 to be precise. These problems have been solved in later .NET 4.0 builds and can be avoided by installing .NET 4.5 on top of you 4.0 installation as well. If that's what was causing your problems, it's still rather difficult to say and some other server-side settings might have caused it, such as now discontinued IIS Lockdown Tool, or even URLScan not accepting lengthy URL requests when the compression for them is enabled.

TL;DR - Either case, the obvious conclusion was to try disabling IIS server's urlCompression for these requests (and/or httpCompression) in your Web.config file, and see if the issues still persist:

<configuration>
   <system.webServer>
      <urlCompression doStaticCompression="false" doDynamicCompression="false" />
   </system.webServer>
</configuration>

This is obviously a hack solution that should be looked into further, by comparing differences between server's and your local environments, if that is at all possible. It is also quite possible that the server wasn't updated with all the latest libraries, and doing so could resolve it as well.

DISCLAIMER: I realize this isn't really a 100% bullet-proof answer, however OP suggested in the comments that it did the trick. I have also posted this question and a possible answer to it on DMZ yesterday, asking if anyone else would know of a better answer and knowing these issues would be immediately recognized by our IT Security wizards, but the St. Patrick's day seems to have taken its toll :)

Cheers!

like image 146
TildalWave Avatar answered Oct 16 '22 08:10

TildalWave