Updating aspnet.config on Azure Web Role
Asked Answered
G

1

6

I have a SignalR solution that is deployed to an Azure Web Role (cloud service, not Azure Web Site) and in order to ensure we can maximise the number of connections to each instance I need to make some changes various ASP.NET settings as detailed in this article: http://www.asp.net/signalr/overview/performance/signalr-performance#tuning

The appConcurrentRequestLimit and requestQueueLimit settings were easily changed with a startup task that uses APPCMD to make the relevant changes. However, the maxConcurrentRequestsPerCPU setting resides in the aspnet.config file which cannot be changed via the same mechanism.

I have tried updating that file directly with a startup task (just a basic file replacement for now), however it seems to get replaced by the Azure runtime after the startup tasks have completed and so the change is lost. I can RDP into the machine and make the change manually so I have seen that it works however that is not sustainable for a service that we expect to scale up and down on demand.

Any ideas on how to change this setting in an Azure environment would be appreciated!

Grosso answered 13/1, 2015 at 8:47 Comment(5)
Perhaps you could use ServerManager class and alter the configuration. Didn't even begin trying this though.Citrin
just another blind shot: have tried replacing that file from OnStart of a RoleEntryPoint class - in web roles we can also have RoleEntryPoint implementation like we do in Worker Roles. Its instance will live in WaIISHost.exe process on the Web Role. This process is always there anyway. And OnStart will be called only after all the IIS changes are made and site is ready to run.Parvis
Thanks both, will give those a try. Also had a suggestion on Twitter which I will try which was to add a registry DWORD named MaxConcurrentRequestsPerCPU within HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\{version}Grosso
Have you tried using Powershell to replace the value and then deploying?Fino
"The appConcurrentRequestLimit and requestQueueLimit settings were easily changed" - appcmd set config /section:system.webserver/serverRuntime /appConcurrentRequestLimit:100000, appcmd set config /section:processModel /autoConfig:false /commit:MACHINE and appcmd set config /section:processModel /requestQueueLimit:250000 /commit:MACHINEKatherinkatherina
G
6

I ended up using the following registry based approach which allowed me to change the maxConcurrentRequestsPerCPU setting without using aspnet.config

I added the following usage of the REG command line utility to my existing startup.cmd (already in use for calling APPCMD to change other settings):

REG ADD HKLM\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0 /v MaxConcurrentRequestsPerCPU /t REG_DWORD /d 10000
REG ADD HKLM\SOFTWARE\Wow6432Node\Microsoft\ASP.NET\4.0.30319.0 /v MaxConcurrentRequestsPerCPU /t REG_DWORD /d 10000

This will configure both 32 and 64 bit application pools, although I only needed 64 in this instance.

Grosso answered 14/1, 2015 at 11:37 Comment(2)
If you're using in a startup task, don't forget /f at the end or it will wait for input the second time.Katherinkatherina
Does the registry change override the aspnet.config xml file?Thalamus

© 2022 - 2024 — McMap. All rights reserved.