ASP.NET 4.0 Web App throwing "Incorrect function. (Exception from HRESULT: 0x80070001)"

user1069816 picture user1069816 · Nov 28, 2011 · Viewed 14.6k times · Source

The application is written in ASP .NET 4.0 hosted in IIS 7.5 on machine running Windows Server 2008 R2. The application pool is using Integrated Managed Pipline Mode.

The exception below is thrown when on several different pages which don’t have anything obvious in common. I can’t reproduce the exception myself, but it happened 10 times last week in the production environment.

From the Stack Trace I see that the exception thrown by the method "HttpRequest.GetEntireRawContent" so I was wondering if there is something wrong with request, such as it being too long or containing an invalid character.

Just to be clear, this exception is not thrown from code that I have written, it is from within the System.Web namespace. So I cannot add a try...catch around it.

I'd be greatful for any ideas on cause of the exception or troubleshooting steps to find out more information.

    Exception: System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): An error occurred while communicating with the remote host. The error code is 0x80070001. ---> System.Runtime.InteropServices.COMException (0x80070001): Incorrect function. (Exception from HRESULT: 0x80070001)
    at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
    at System.Web.Hosting.IIS7WorkerRequest.ReadEntityCoreSync(Byte[] buffer, Int32 offset, Int32 size)
    at System.Web.HttpRequest.GetEntireRawContent()
    at System.Web.HttpRequest.FillInFormCollection()
    at System.Web.HttpRequest.get_Form()
    at System.Web.HttpRequest.get_HasForm()
    at System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull)
    at System.Web.UI.Page.DeterminePostBackMode()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.HandleError(Exception e)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    at System.Web.UI.Page.ProcessRequest()
    at System.Web.UI.Page.ProcessRequest(HttpContext context)
    at ASP.report_openinghours_aspx.ProcessRequest(HttpContext context)
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

EDIT:

As pointed out by lukiffer there is a similiar question here: stackoverflow.com/questions/7825127/ The suggested fix is to turn off TCP offloading, the way I understand it is that TCP offloading shields the webserver from a lot of the complexity of TCP. Therefore turning it off would consume a lot of CPU cycles so slow down the web servers, which is obviously not desirable.

I also don't understand why TCP offloading would cause IIS to throw an exception.

Answer

using System.Noob picture using System.Noob · Dec 29, 2014

You couldn't possibly still have this issue, but if others run into this issue here is a link that might help.

TechNet forum

TCP Task Offloading options of the NIC driver should be set at the physicla NIC level (the nic of the host that the External virtual network is using). Be sure that you are not disabling chimney and thinking that you are disabling Task Offloading. In the settings of the driver are options with 'offloading' in the name - these are the options to turn off.

  • Disable Power managment on the phsycial NIC (some drivers turn this on).

  • Try a physical Intel NIC (the least problematic of all with Hyper-V)

  • Check that the ICs in the VM are equal to the host.

  • Check for other issues with the VM such as resource spiking with CPU or disk IO or anything else that might cause a hang.