title: System.Net.WebException: The operation has timed out
body: <p>I have a complex code , in one section I send a rest webrequest to a web service and get its response for rest of job , the response have variant size , some times its heavy , on IIS Express on VS there isn't any problem but when going live on IIS it throw  System.Net.WebException: The operation has timed out.  and this is the code I use :</p>
  
  <pre><code>  Dim req As HttpWebRequest = TryCast(WebRequest.Create("http://www.somedomain.com/service.svc"), HttpWebRequest)
          Using TryCast(req, IDisposable)
              req.Proxy = Nothing
              req.ServicePoint.ConnectionLimit = 100
              req.ServicePoint.MaxIdleTime = 3000000
              req.Method = "POST"
              req.Headers("Accept-Encoding") = "gzip,deflate"
              req.ContentType = "application/soap+xml; charset=UTF-8"
  
              If compressionRequested = True Then
                  ''  if you want to receive compressed response 
  
                  req.Headers.Add("Accept-Encoding", "gzip, deflate")
              End If
              Dim stOut As New StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII)
  
              stOut.Write(xml.ToString)
              stOut.Close()
  
  
              Using resp As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)
                  If resp.ContentEncoding = "gzip" Then
  
  
                      Dim st As Stream = resp.GetResponseStream()
                      If resp.ContentEncoding.ToLower().Contains("gzip") Then
                          st = New System.IO.Compression.GZipStream(st, System.IO.Compression.CompressionMode.Decompress)
                      ElseIf resp.ContentEncoding.ToLower().Contains("deflate") Then
                          st = New System.IO.Compression.DeflateStream(st, System.IO.Compression.CompressionMode.Decompress)
                      End If
                      Dim bfst As BufferedStream = New BufferedStream(st)
                      Using stIn As New StreamReader(bfst, Encoding.[Default])
                          respXml = stIn.ReadToEnd()
  
  
                          stIn.Close()
                      End Using
  
                  Else
                      Using stIn As New StreamReader(resp.GetResponseStream())
                          respXml = stIn.ReadToEnd()
  
                          stIn.Close()
                      End Using
                  End If
              End Using
  
          End Using
  </code></pre>
  
  <p>also in web.config I configured this :</p>
  
  <pre><code>&lt;system.net&gt;
  &lt;connectionManagement&gt;
          &lt;add address="*" maxconnection="100" /&gt;
          &lt;/connectionManagement&gt;
      &lt;settings&gt;
        &lt;servicePointManager expect100Continue="true" /&gt;
      &lt;/settings&gt;
    &lt;/system.net&gt;
  </code></pre>
  
  <p>Is there any suggest where is the problem and how to solve ?</p>