1

I have an azure function where I am getting failure rate like below.

Host thresholds exceeded: [Connections]. For more information, see https://aka.ms/functions-thresholds.

On my initial finding I found below link https://aka.ms/functions-thresholds

As per above link I found problem is because of Number of outbound connections

On my further search this could be possible because of three reasons as per below link

https://learn.microsoft.com/en-us/azure/azure-functions/manage-connections

Now Since I am not using any Http Client and DocumentClient so I am sure there is something wrong with SQL connection as my Azure function calling some class libraries internally and all these libraries work with SQL.

Now as per the below documentation I am highly confused like what to in case of optimizing this.

Some data frameworks, such as Entity Framework, typically get connection strings from the ConnectionStrings section of a configuration file. In this case, you must explicitly add SQL database connection strings to the Connection strings collection of your function app settings and in the local.settings.json file in your local project. If you are creating a SqlConnection in your function code, you should store the connection string value in Application settings with your other connections.

In first paragraph it is saying store SQL connection string under Application settings - > Connection strings collection.

In second paragraph its saying store SQL connection string under Application setting so does my question is - Does it means like Application settings - > Application settings collection.

Since all libraries which I am calling are getting connection string from configuration file with

So If I store SQL connection string under app setting then I have to change the calling style based on below setting

Can any body elaborate more where exactly store SQL connection string under the Function App setting ?

Also is there any way to use avoid below error ?

Host thresholds exceeded: [Connections]. For more information, see https://aka.ms/functions-thresholds. Problem Id:System.InvalidOperationException at Microsoft.Azure.WebJobs.Script.ScriptHostManager.IsHostHealthy

JARVIS
  • 765
  • 1
  • 8
  • 28
  • 1
    My first suggestion would be reviewing your code. And then you can try to reduce WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT to a smaller number to see if the problem still occurs. – Hung Cao Sep 12 '18 at 23:00

1 Answers1

1

You can set the database connection string in the app settings in azure portal, steps as below:

  1. Nav to azure portal -> your function app

  2. Go to overview panel -> select application settings enter image description here

  3. Under application settings, go to the Connection String node, click add new connection string to add your string enter image description here

For more details, refer to here

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60