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

1

10

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.

Potshot answered 28/11, 2011 at 17:35 Comment(6)
See: #7825627Enrobe
Can you post the code inside 'report_openinghours.aspx.cs' which is calling the remote service / data source, including any COM calls and objectsAbuttal
The code inside 'report_openinghours.aspx.cs' does not call a remote service / data source, or any COM calls or objects. It looks like the code using a COM object is in the IIS7WorkerRequest class.Potshot
TCP offloading puts the work of TCP processing to your NIC. If the NIC is not doing this properly, it could cause all kinds of issues.Cookout
Try this: https://mcmap.net/q/73379/-quot-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-quot-even-when-the-platforms-are-the-same This worked for me on a similar error, maybe it's the same with your problem.Mylo
Thanks for answering, could you let me know which exception you were receiving? which of the answers to https://mcmap.net/q/73379/-quot-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-quot-even-when-the-platforms-are-the-same worked for you?Potshot
L
0

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.

Lavonlavona answered 29/12, 2014 at 18:18 Comment(2)
Please say why you believe this is a solution to the problem.Brune
I don't claim to be an expert just some experience with VMs and some complex environments. My best idea to what is actually going on is that the power management for the hardware driver is conflicting with services and processes that require constant and immediate access to the driver. Keeping the driver from saving power isn't practical for server environment; which is to say that I've never ran a COA on a network card, but just include it in your operating costs and eliminate it as a variable of potential issues in your environment.Lavonlavona

© 2022 - 2024 — McMap. All rights reserved.