18

I am getting a weird error. I have setup a script that works perfectively when Fiddler is open - it downloads a report from a website using httpwebrequest and everything works fine!

HOWEVER it only works when Fiddler is open ? When fiddler isnt working I just get a "Request Timeout Issue"

Does anyone know how to fix this and make it work with my ASP.NET MVC App?

Thanks

Edit: Thanks for the response! Regarding proxy - I wanted to test this script on Windows Azure - so little confused as to how to setup the default proxy settings ?

AMissico
  • 21,470
  • 7
  • 78
  • 106
  • 1
    I've heard a few folks report that they encounter issues like this-- basically Fiddler *increases* the upload performance vs. some common client configurations. Generally, unless you can tune the client software (e.g. changing upload buffer sizes) your best bet is to increase the timeout on the server to allow a longer period before upload. As to *why* Fiddler helps in this scenario, Fiddler buffers requests by default, so your application sends the full request to Fiddler, which collects it all, THEN makes a connection to the server, and blasts the data to the server as fast as possible. – EricLaw Jul 30 '09 at 16:46

6 Answers6

13

For searchers, here is another thought. I have an application that manipulates my website in a robotic fashion. The application uses HttpWebRequest and HttpWebResponse in .Net 4.0. After two or 3 successful GET's, the next would lock up consistently. Another post suggested that not properly closing an HINTERNET could cause an application to block on a subsequent GET to the same host due to a limit on the number of parallel connections to the same host. I don't know if this is what was happening under the covers, but I thought I would go back and determine where I could close things.

I closed all of my HttpWebResponse objects in the code and my issue went away. From this I don't see why Fiddler would mask the issue, but it did. Before adding the closes, a specific request in the sequence would consistently time out. After closing responses, that all cleared up and I could run without proxying through Fiddler.

  • Yep this was my issue. So simple, it was failing consistently after 2 requests. Thanks Prof! – TDH May 09 '12 at 15:53
  • I can confirm as well - a simple response.Close(); fixed my problem. – Anders Oct 12 '14 at 11:59
  • I would also like to add my thanks for this post (4 years later!), as this also applies to Powershell3 and System.Net.WebRequest objects not being cleaned up when they go out of scope; so I had to add a call to [System.Net.WebRequest].abort() before going out of scope and in all the try/catch blocks. – JonnyG Mar 30 '15 at 22:01
3

Closing all HttpWebRequest objects as @ProfVonLemongargle suggested fixed the same issue I was having.

Fiddler is likely closing the connections to the server so the concurrent connection limitation is masked when your app is using it as a proxy. See this thread for additional info: HttpWebRequest times out on second call

Community
  • 1
  • 1
Gloopy
  • 37,767
  • 15
  • 103
  • 71
2

Be aware that Fiddler acts as a proxy. Having an application work when Fiddler is running but not otherwise could indicate a problem with your default proxy setup. Open Internet Options (possibly through IE) and check your proxy settings. In particular, note whether you are configuring through a script.

I'll mention one very unlikely possibility, though it actually happened to me. I had a Certain Anti-Virus Product installed on my machine. For some reason, it thought that my Subscription had Expired. The result was that the software would not run, and therefore could not update the list of programs allowed to access the Internet. Programs I installed after the expiration would not work unless Fiddler was running (since Fiddler was installed before the expiration, it was on the "Good" list). Any other program installed after the expiration was on the "Bad" list (by default).

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • Thanks for the response! Regarding proxy - I wanted to test this script on Windows Azure - so little confused as to how to setup the default proxy settings ? –  Jun 23 '09 at 01:53
  • Do you have it running on your normal Windows system yet? Do that before you concern yourself with Azure. – John Saunders Jun 23 '09 at 03:56
1

Are you running with HTTPS? If so, your code may not trust the remote site's certificate, and Fiddler could be passing along the data to your app. Send us the error message and a minimal amount of code which replicates this problem.

Dave Markle
  • 95,573
  • 20
  • 147
  • 170
  • Hi Dave, yep - running with HTTPS. Im not at my PC where the code is though (at work) any ideas (if this is case) how to fix this prob? –  Jun 23 '09 at 01:55
  • Take a look at http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.servercertificatevalidationcallback.aspx. You'll probably need to tell your code to accept the cert of the site you're talking to. – Dave Markle Jun 24 '09 at 01:52
  • Fiddler will show a modal warning dialog if the site is presenting the wrong certificate, so I don't think that's what this user is encountering. – EricLaw Jul 30 '09 at 16:42
1

older chain, but I discovered the same issue in our code. It was because there were leftover console.log commands in the javascript. This led to blocked javascript code.

0

Had the same issue on a corporate network, I opened Fiddler2 to diagnose what was being sent/received and the problem went away! After further research I found that Fiddler tunnels traffic through it like a proxy and my corporate network also uses an automatic configuration script for a proxy (I assume Fiddler was tunneling it through the proper system proxy of which my app didn't know about)

To get my VB.net program running all I had to do was add the proxy settings to the request:

Dim proxy = WebRequest.GetSystemWebProxy()
oRequest.Proxy = proxy
bfritz
  • 2,416
  • 2
  • 20
  • 29