System.Web.HttpException: 'The remote host closed the connection

0

While executing the WebDAVServer.SQLStorage.ASPNet and WebDAVServer.FileSystemStorage.ASPNet applications, I am receiving the following error:

System.Web.HttpException: 'The remote host closed the connection. The error code is 0x800704CD.'

My code is as follows:

public async Task ProcessRequestAsync(DavContextBaseAsync context, IHierarchyItemAsync item)
    {
        if (item is IItemCollectionAsync)
        {
            // In case of GET requests to WebDAV folders we serve a web page to display 
            // any information about this server and how to use it.

            // Remember to call EnsureBeforeResponseWasCalledAsync here if your context implementation
            // makes some useful things in BeforeResponseAsync.
            await context.EnsureBeforeResponseWasCalledAsync();
            IHttpAsyncHandler page = (IHttpAsyncHandler)System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(
                "~/MyCustomHandlerPage.aspx", typeof(MyCustomHandlerPage));

            if(Type.GetType("Mono.Runtime") != null)
            {
                page.ProcessRequest(HttpContext.Current);
            }
            else
            {
                // Here we call BeginProcessRequest instead of ProcessRequest to start an async page execution and be able to call RegisterAsyncTask if required. 
                // To call APM method (Begin/End) from TAP method (Task/async/await) the Task.FromAsync must be used.
                await Task.Factory.FromAsync(page.BeginProcessRequest, page.EndProcessRequest, HttpContext.Current, null);
            }
        }
        else
        {
            await OriginalHandler.ProcessRequestAsync(context, item);
        }
    }
c#
asp.net
ithit-webdav-server
asked on Stack Overflow Jul 26, 2017 by Raja • edited Jul 26, 2017 by iamdanchiv

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0