Empty response in webapp

Michele Guion 6 Reputation points
2023-12-01T08:12:25.5266667+00:00

Hello,

we have a .NET 7 webapp which often (more than 70% of cases) returns a blank page.

In particular, the response content length is always 2470 bytes. Due to this content truncation, the response contains only a part of the HTML head and no body, and this is the reason for a blank page.

If we analyze web application logs, we always see HTTP 200 with more than 33000 bytes in response, but the client always receives 2470 bytes.

We are struggling with this issue since we have migrated our .NET Framework 4.7.2 code to .NET 7 and we can't go live until we fix it.

This happens only on Azure and never on local IIS.

We have activated all possible logs and everything seems fine, but the client downloads 2470 bytes.

If someone has any advice, it will be welcome.

Thanks

Michele

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,381 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,356 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Michele Guion 6 Reputation points
    2023-12-05T07:40:41.6433333+00:00

    Hello @JasonPan - MSFT

    I think we have identified the issue a few hours ago. We had a functionality that was meant to emulate the behavior of HtmlHelper.Action, no more present in AspNetCore.Mvc.

    This created another HttpContext and populated a HTML string, written in the body of the sub-request.

    I suppose that this behavior was not always good for MVC engine, that sometimes sent a truncated response.

    We replaced our custom HtmlHelper.Action with partial views, and everything seems fine, now.

    I'll update the task if we find out something else.

    Thanks

    Michele

    0 comments No comments

  2. Pinaki Ghatak 3,110 Reputation points Microsoft Employee
    2024-01-24T16:07:29.8733333+00:00

    Hello @Michele Guion I can suggest some troubleshooting steps that may help you identify and resolve the issue:

    1. Check the response headers: Check the response headers to ensure that the content length is not being set to 2470 bytes. If it is, then this could be the reason for the issue. You can use a tool like Fiddler or Postman to inspect the response headers.
    2. Check the web server logs: Check the web server logs to see if there are any errors or warnings that could be related to the issue. You can also check the logs for any requests that are returning a 2470-byte response.
    3. Check the application logs: Check the application logs to see if there are any errors or warnings that could be related to the issue. You can also check the logs for any requests that are returning a 2470-byte response.
    4. Check the network traffic: Use a tool like Wireshark to capture the network traffic between the client and the server. This can help you identify any issues with the network that could be causing the response to be truncated.
    5. Check the Azure configuration: Check the Azure configuration to ensure that it is set up correctly. This includes checking the web app settings, application gateway settings, and any other relevant settings. I hope this solves your issue.
    0 comments No comments