PrestaSharp icon indicating copy to clipboard operation
PrestaSharp copied to clipboard

WebException: Timeout

Open MrViSiOn opened this issue 8 years ago • 4 comments

Hi guys!

I've been getting crazy with this issue... I've developed a softaware wich updates all my stock adding new products to my shop...

But sometimes, no reason, my prestasharp throws an error like this

`Anulada la solicitud: Se excedió el tiempo de espera de la operación. HttpStatusCode: 0 ---> System.Net.WebException: Anulada la solicitud: Se excedió el tiempo de espera de la operación. en System.Net.HttpWebRequest.GetResponse() en RestSharp.Http.GetRawResponse(HttpWebRequest request) en RestSharp.Http.GetResponse(HttpWebRequest request) --- Fin del seguimiento de la pila de la excepción interna --- en Bukimedia.PrestaSharp.Factories.RestSharpFactory.Execute[T](RestRequest Request) en \importador2\CRVImporter\PrestaSharp\Factories\RestSharpFactory.cs:línea 60 en Bukimedia.PrestaSharp.Factories.ProductFactory.Add(product Product) en \PrestaSharp\Factories\ProductFactory.cs:línea 37

Timeout...

Time later after stop that windows service, I rerun my software and everything works fine, same xml, same request... my connection is stable and I think that is not the issue.

Even I changed client.Timeout in Execute function in RestSharpFactory

client.Timeout = Int32.MaxValue;

Tried with

client.Timeout = -1;

But, my Exception is still appearing when "It wants"...

Any idea of what is happening here?

Any help would be appreciated

MrViSiOn avatar Dec 21 '16 15:12 MrViSiOn

I had the same problem Seems to be because HttpWebRequest default timeout is 100 seconds. My fix was to add client.Timeout = 3600000; in RestSharpFactory.cs in ExecuteForFilter<T> function

See also: https://stackoverflow.com/questions/46584175/restsharp-timeout-not-working

ramb0t avatar Nov 01 '17 13:11 ramb0t

I had the same problem Seems to be because HttpWebRequest default timeout is 100 seconds. My fix was to add client.Timeout = 3600000; in RestSharpFactory.cs in ExecuteForFilter<T> function See also: https://stackoverflow.com/questions/46584175/restsharp-timeout-not-working

how you do that? did you included all the files on your project or used the nuggets?

tcastro avatar Jul 13 '19 15:07 tcastro

Hi guys!

I've been getting crazy with this issue... I've developed a softaware wich updates all my stock adding new products to my shop...

But sometimes, no reason, my prestasharp throws an error like this

`Anulada la solicitud: Se excedió el tiempo de espera de la operación. HttpStatusCode: 0 ---> System.Net.WebException: Anulada la solicitud: Se excedió el tiempo de espera de la operación. en System.Net.HttpWebRequest.GetResponse() en RestSharp.Http.GetRawResponse(HttpWebRequest request) en RestSharp.Http.GetResponse(HttpWebRequest request) --- Fin del seguimiento de la pila de la excepción interna --- en Bukimedia.PrestaSharp.Factories.RestSharpFactory.Execute[T](RestRequest Request) en \importador2\CRVImporter\PrestaSharp\Factories\RestSharpFactory.cs:línea 60 en Bukimedia.PrestaSharp.Factories.ProductFactory.Add(product Product) en \PrestaSharp\Factories\ProductFactory.cs:línea 37

Timeout...

Time later after stop that windows service, I rerun my software and everything works fine, same xml, same request... my connection is stable and I think that is not the issue.

Even I changed client.Timeout in Execute function in RestSharpFactory

client.Timeout = Int32.MaxValue;

Tried with

client.Timeout = -1;

But, my Exception is still appearing when "It wants"...

Any idea of what is happening here?

Any help would be appreciated

Hello Friend,

This happens due to .net System.Net.ConnectionManagement blocks max 2 Connection per Address Simultaneously

to Over Come this

Add this to your app.config

<configuration>
  <system.net>
    <connectionManagement>
      <add address = "*" maxconnection = "50" />
    </connectionManagement>
  </system.net>
</configuration>

mufkuw avatar Sep 11 '20 08:09 mufkuw

I had the same problem Seems to be because HttpWebRequest default timeout is 100 seconds. My fix was to add client.Timeout = 3600000; in RestSharpFactory.cs in ExecuteForFilter function See also: https://stackoverflow.com/questions/46584175/restsharp-timeout-not-working

how you do that? did you included all the files on your project or used the nuggets?

I believe I compiled it myself back then

ramb0t avatar Oct 29 '20 15:10 ramb0t