简体   繁体   中英

VS2015/ASP.NET WebService: Server-side timeout, Connection aborted

This timeout is making me crazy guys, I really need your help to understand it:

I got a client, which is a python/WSGI/flask app (on a Tornado server) that use the lib requests to call a web service within my server, a ASP.NET website project (running on VS2015 iisexpress.exe for now).

The web service is simply declared with a .svc file and a C# class with [ServiceContract] and [OperationContract] annotations, and nothing about this WebService in the web.config .

 [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class GestionCand
    {
     ...
        [WebInvoke(Method = "POST", UriTemplate = "cand/listByPk", RequestFormat = WebMessageFormat.Json)]
        [OperationContract]
        public Message GetbyPkList(String listPk)
        {
        ...

Everything is working well, until I try a request that take 3 to 4 minutes to process (a long mapping loop with thousands of entries). The call works, but after 2 min, while my .NET web service is still in the loop (so without errors and before it reach the end of the code), my python app says:

File "/Mis/lib/python2.7/site-packages/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', BadStatusLine("''",))

I was not sure of that error, but after some search, it means that the server decided to stop the connection, and that's what I see on wireshark (a TCP call from ASP.NET server to python app with [FIN,ACK] ), but the .NET code is still running normally, it hasn't finised yet. My WebService execution finishes 1 minute after the connection is aborted, so when the server decide to cut the connection, it don't wait or stop the execution.

And there where I started to try a lot of solutions and none of them has worked: change the <httpRuntime executionTimeout> (and compilation on debug=false ), create a different web.config in the WebService folder to set this executionTimeout , add a basicHttpBinding section to set the SendTimeout , set Timeout=None on python requests call... Nothing has changed that 2 min timeout.

It's really IIS/ASP.NET that do this timeout ? Is there anyway to change it ? What I'm doing wrong ?

I tryed my long execution on the production server (IIS8).... and it works ! without any timeout setting ! This uneditable server-side timeout seems to exists only on VS2015 IIS Express....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM