question

MichelleBlum-2831 avatar image
0 Votes"
MichelleBlum-2831 asked ryanchill commented

Is there a limit as to the number of application settings I can have configured for my app?

My Api has stopped loading in Azure with no code changes. The Web App seems to be failing to startup with the error,
“The environment block used to start a process cannot be longer than 65535 bytes. Your environment block is xxxx bytes long. Remove some environment variables and try again.”

The error makes it sound like this is a limit. However, if there is some sort of limit here then why would the error suddenly start throwing without changes to the api code?

azure-webapps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
1 Vote"
ryanchill answered ryanchill commented

There is a known limitation of the .Net Framework where the length of an environment block is limited to 65535 bytes.

As to a resolution or workaround, here we have a few options,
- Reduce the number of AppSettings in the application
- Save some settings in another store such as Redis, SQL, NoSQL, etc.
- Separate the variables into multiple app services
- Store the environment variables into a .txt file in a storage account and access them from the file in storage

Regarding why this would happen suddenly, the error occurs during code compilation.
If say an environment variable is added during the build process and you are already near the threshold due to a high number of configured app settings, then any system generated flag can cause the error to throw.
The .Net source code showing where this error throws can be referenced here: Process.cs (microsoft.com)

Since this is being implemented by the .Net framework, it would not be possible to increase the limit.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is there any way to do it without code changes? In my case, it's actually cause by CORS Policy because we have so many subdomain. Is there a way to change the reference from app setting to key vault or storage account? Thank you

0 Votes 0 ·
0 Votes 0 ·