how to fix Azure app http status 400 substatus 604 error-

华 仲 25 Reputation points
2023-12-18T14:29:42.5+00:00

Hello,

I deployed a web to Azure web app service a month ago. It frequently went down. I am asking how to fix this problem. Below is the detail.

the web app service is on windows server. I chose B1 as my service plan. My website is composed with a back-end api (.Net 6) and React SPA. In React, I used Axios to make HTTP request.

At the beginning, the website was fine. Myfriends and me were able to visit and interact with it. But later, we cannot visit the website. It frequently went down. In the Browser Debug mode Network tab, you could find the xhr request said" cannot load response data". But if you directly typed a api url (a "get" api in my website api) in the browser, it would give you the correct json data. Then the webiste suddenly became good. You could visit it normally. For about 30 mininutes later (the time is estimated), the webiste went down again.

The azure troubleshooting detects some errors. It said the front-end(the seven-load balancer functioning as proxy) detect some error regarding "Client Gone-The client that originated the request seems to have closed the connection before the response was received." . Furthermore, it said that Proxy exceptions detected where the client disappeared before the request could be completed. The diagnostic page also gave me a table displaying proxy exceptions that occurred while sending requests from the FrontEnd to the worker, resulting in exceptions.Here is the detail info in the table.

krpbfe: ProxyError, Site: blueprintforlife, Host: blueprintforlife.azurewebsites.net, Method: GET, Url: /api/getThumbnail, ServerRouted: 10.0.0.12, ProxyError: RequestCanceled, RequestAborted: True, RemoteAddress: 111.163.122.252, ConnectedTime: 14734ms, ProxyException: System.Threading.Tasks.TaskCanceledException: The operation was canceled.
---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at Microsoft.Web.Hosting.Frontend.Utilities.ProxyMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpMessageInvoker.g__SendAsyncWithTelemetry

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,937 questions
{count} vote

Accepted answer
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2024-01-02T19:14:41.1166667+00:00

    To benefit the community, posting the offline discussion:

    As @华 仲 mentioned :

    "The website down symptom was the same no matter in plan D1 or in plan B1 (the app was in plan B1 in November the whole month). The only difference is if it is in plan B1 and turn on "always on", the issue is gone. "

    Based on the webapp usage/requirement, the recommendation would be to leverage B1 plan with Always On feature enabled.

     

    To provide more background on this, by default, web apps are unloaded if they're idle for a set period of time. This way, the system can conserve resources. The downside is that the response to the first request after the web app is unloaded is longer, to allow the web app to load and start serving responses. In Basic and Standard service plans, you can turn on the Always On setting to keep the app always loaded. This eliminates longer load times after the app is idle.

     

    FAQ: How do I decrease the response time for the first request after idle time?
    https://learn.microsoft.com/troubleshoot/azure/app-service/web-apps-performance-faqs#how-do-i-decrease-the-response-time-for-the-first-request-after-idle-time

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-12-20T10:53:09.5766667+00:00

    @华 仲 ,

    Edit: Update from offline discussion, to benefit the community.
    Based on the webapp usage/requirement, the recommendation would be to leverage B1 plan with Always On feature enabled.

    Based on the information you provided, it appears that the issue is related to the client closing the connection before the response is received. This can happen due to various reasons such as network issues, server overload, or application errors. 

    I understand your WebApp was provisioned 1 month ago. If you haven’t done, Please take a look the steps to isolate the issue:

    1.As a quick step to isolate the issue, you may scale up or scale-up the App Service Plan and see if it helps. (you may later scale-down)

    Azure App Service represents a fleet of scale units. An app service always runs in an ASP.

    1. I understand you have reviewed the diagnostic logs.  Review Enable and review logs to fetch more details about the error.

    Check if the issue is confined to any specific clients/users or happens to everyone.

    1. If Always On is disabled, please enable it.

     When Always On isn't turned on (default), the app is unloaded after 20 minutes without any incoming requests. The unloaded app can cause high latency for new requests because of its warm-up time. When Always On is turned on, the front-end load balancer sends a GET request to the application root every five minutes. The continuous ping prevents the app from being unloaded.

    4.Turn off ARR affinity: If it’s a multi-instance deployment, ensure that the client is routed to the same instance for the life of the session. You may set this option to Off for stateless applications and then check how it goes.

     

    Kindly let us know, I’ll follow-up with you further.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.