W3wp thread is getting cancelled with exception "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification"

25 views Asked by At

We have a web application on 4.8 .net framework running on IIS6. we have a service manger which conncet business layer and controller using Proxy Parttern. in the service manager for few of the APIs we are making a async call and hence we are adding await to hold the w3wp thread so that the other thread completes the businees logic.

public async Task<ResultInfo> GetRegions(string RemotePatchingConnectivityType)
    {
        ResultInfo result = new ResultInfo();
        try
        {
            result.Data = await GetMyProxy().GetRegions(RemotePatchingConnectivityType);
            result.Status = (result.Data != null) ? ResultStatus.Success : ResultStatus.Failure;
        }
        catch (HttpRequestException ex)
        {
            result.Status = ResultStatus.Failure;
            result.Details = ex.Message;
        }
        catch (Exception ex)
        {
            result.Status = ResultStatus.Failure;
            result.Details = HubRes.CommonExceptionMessage;
            Logs.Err($"Unable to get region due to {ex.StackTrace}");
        }
        return result;
    }

But as it crosses the awit line, after some time the w3wp is getting cancelled with below exception:

at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass7_01.<CreateGenericTask>b__0(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Philips.FocusPoint.CloudHubServices.ServiceMgr.d__15.MoveNext() in ~\Business\ServiceMgr.cs:line 225

We never faced such an issue before.

I increaed the connection time out of the site in IIS to 4 min and in gateway service(running on IIS) to 3 min but still no luck. The debug is set to true in the web.config

Please guide me to resolve this issue.

I increased the connection time out of the site in IIS to 4 min and in gateway service(running on IIS) to 3 min but still no luck. the wpw3 Shouldn't get cancelled

0

There are 0 answers