Simulate Function App -> HTTPClient request -> Hybrid Connection Manager -> OnPremIIS
Create a Azure VM and install IIS
Create a Web API project by Visual Studio and deploy to IIS server
Create a function with Standard plan
Config Hybrid connection manager
Install Hybrid connection manager connector in OnPrem Server (step 1)
Create a Function App project simulate HTTPClient to send request to IIS Server via Hybrid Connection Manager
Deploy Function App to Azure Function
Execute request -> OnPremIIS (Thread sleep 50 seconds) -> get response
Function log
1
2
3
4
5
6
72019-11-07T02:46:21.684 [Information] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=efdfa4cb-446d-4102-b7ce-3d3eea05b04c)
2019-11-07T02:46:21.806 [Information] C# HTTP trigger function processed a request.
2019-11-07T02:46:22.289 [Information] Start client.SendAsync
2019-11-07T02:47:12.848 [Information] End client.SendAsync
2019-11-07T02:47:12.849 [Information] 200
2019-11-07T02:47:12.849 [Information] "50 seconds, you can see it."
2019-11-07T02:47:12.903 [Information] Executed 'Function1' (Succeeded, Id=efdfa4cb-446d-4102-b7ce-3d3eea05b04c)HTTP 200 with Output:
1
{"Timestamp":"2:46:22 AM","FileName":"YourFileName: 3","FileSize":"ProvideFileSize","ReturnCode":"0","ReturnMessage":null}
Execute request -> OnPremIIS (Thread sleep 150 seconds) -> get exception
Function Log:
1
2
3
4
5
62019-11-07T02:31:43.647 [Information] Executed 'Function1' (Succeeded, Id=61383988-8e65-4cf8-9995-3cd718ed289e)
2019-11-07T02:32:50 No new trace in the past 1 min(s).
2019-11-07T02:32:50.030 [Information] One or more errors occurred. (A task was canceled.)
2019-11-07T02:32:50.035 [Information] A task was canceled.
2019-11-07T02:32:50.035 [Information] [null]
2019-11-07T02:32:50.036 [Information] Executed 'Function1' (Succeeded, Id=3961b106-3f59-4909-90d3-4d16a1f7bb53)HTTP 200 with Output:
1
{"Timestamp":"2:31:10 AM","FileName":"YourFileName: 1","FileSize":"ProvideFileSize","ReturnCode":"9","ReturnMessage":"Type: System.AggregateException, Msg: One or more errors occurred. (A task was canceled.)"}
Reviewed Exception in Application Insights
Root cause:
Responding to requests
The receiver MUST respond. Repeated failure to respond to requests while maintaining the connection might result in the listener getting blacklisted.
Responses may be sent in any order, but each request must be responded to within 60 seconds or the delivery will be reported as having failed. The 60-second deadline is counted until the response frame has been received by the service. An ongoing response with multiple binary frames cannot become idle for more than 60 seconds or it is terminated.
For more information: https://docs.microsoft.com/en-us/azure/service-bus-relay/relay-hybrid-connections-protocol
Sample Code:
My Function:
1 | using System; |
############################
My Web API
1 | public string Get(int id) |
######################################
Function app timeout duration
The timeout duration of a function app is defined by the functionTimeout property in the host.json project file. The following table shows the default and maximum values in minutes for both plans and in both runtime versions:
More information: https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale
HTH. By Jacky 2019-11-19