Post to Azure Function with body over 10K doesn't reach Azure Function

Don Gillett 0 Reputation points
2024-08-05T18:36:21.31+00:00

We have an Azure Function with an HTTP binding. It is bound to POST. The call works fine when we call it with a body smaller than 10K. When the size goes above that the call fails. The log steaming on the Azure Functions console doesn't show it even making it to the server. The default max size for an Azure function is documented to be 100Mb. We have also looked at all the posts we can find about setting the size of the allowed post and none of the suggested methods (host file entry and env variables in console) have any effect. When we run the Azure function on a local dev machine it looks fine. I suspect it has to do with networking config on the Azure side as the error we get back is "failed to copy content", followed by a bunch of SSL handshake failures... although we think the later is unrelated fallout from the actual failure. Note that we deployed a completely clean and default version of our service and it still fails. Many thanks in advance for idea to look at.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,869 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Konstantinos Passadis 19,066 Reputation points MVP
    2024-08-05T19:15:31.1+00:00

    Hello @Don Gillett

    Welcome to Microsoft QnA!

    Since you already tried some settings i suggest

    Try the Premium SKU for Azure Functions or Scale Up the Service

    Also

    Try this Setting

    Name: WEBSITE_MAX_REQUEST_LENGTH

    Value: 104857600 // 100MB in bytes

    Also

    1. Use Azure Application Insights to capture detailed logs and telemetry from your Azure Function. This might provide more information about what's happening when the request fails.
    2. In your Azure Function, enable Application Insights and configure it to capture HTTP request and dependency telemetry.

    Check Network Settings and what is between the caller and the endpoint

    Kindly let us know with some insights from Application Insights as well

    --

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


  2. Konstantinos Passadis 19,066 Reputation points MVP
    2024-08-05T20:18:38.6766667+00:00

    Hello @Don Gillett

    Thanks for the input!

    The error message "Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host" implies that the problem may arise before the request reaches the Azure Function. It usually points to a networking or transport layer issue, not an issue with the Azure Function.

    The issue is likely related to the network or SSL/TLS configuration rather than the Azure Function itself. Investigate potential problems with proxies, SSL/TLS configurations, client-side network settings, and Azure service configurations.

    Suggestions:

    1. Try without anything between , directly with a Postman call for example
    2. Check whatever is between your Function and the originator , i belive something refuses to pass on the payload !!!

    --

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


  3. Konstantinos Passadis 19,066 Reputation points MVP
    2024-08-05T21:45:33.2166667+00:00

    Hello @Don Gillett

    While i am investigating kindly validate:

    You dont have nothing in front of AzureFunctions and also you dont have Network Injection

    Please try this :

    https://learn.microsoft.com/en-us/answers/questions/965564/how-to-solve-an-existing-connection-was-forcibly-c

    Taken from the post to help you :

    When connecting over HTTPS, you have to consider if target is using SSL, TLS 1.1 or TLS 1.2, and properly enable on your end. Also have in mind .NET will check for valid certificate of target address.

    I know you working on .Net Core6, but for .Net Framework whe use: To enable SSL, TLS 1.1 and TLS 1.2 on your end. Important this set is Global (for .Net Framework). This should fix exception "An existing connection was ..." System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol Or System.Net.SecurityProtocolType.Tls11 Or System.Net.SecurityProtocolType.Tls12

    system.net.servicepointmanager.securityprotocol

    Look for system.net.servicepointmanager.servercertificatevalidationcallback if you want bypass certificate validation.

    --

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


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.