ApplicationHost.xdt in Azure Web Apps

后端 未结 1 1827
既然无缘
既然无缘 2020-12-21 01:08

How to change applicationHost.config in an Azure web app? I try:

using (ServerManager serverManager = new ServerManager())
{
    Microsoft.Web.Administration         


        
相关标签:
1条回答
  • 2020-12-21 01:34

    The way to do this is to use XML Document Transforms (XDT) which is referenced here.

    For your scenario, create a file called applicationhost.xdt that contains the following:

    <configuration  xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
      <system.applicationHost>
        <webLimits xdt:Transform="SetAttributes(connectionTimeout)"
                   connectionTimeout="00:00:10" />
        <webLimits xdt:Transform="SetAttributes(dynamicIdleThreshold)"
               dynamicIdleThreshold="150" />
        <webLimits xdt:Transform="SetAttributes(headerWaitTimeout)"
                   headerWaitTimeout="00:00:10" />
        <webLimits xdt:Transform="SetAttributes(minBytesPerSecond)"
                   minBytesPerSecond="500" />
      </system.applicationHost>
    </configuration>
    

    Then, using an FTP client (I used FileZilla), copy it to the site folder (not wwwroot) for your web app.

    enter image description here

    Finally, restart your web app which you can do from the Azure portal.

    You can verify the changes are applied using the Kudu site extension. After signing into Kudu, go to the Debug Console (CMD) window and drill down into the Logfiles folder and then the Transform folder.

    enter image description here

    In the Transform folder you will see a "*scm.log" file that will show the transformations. It should look something like this.

    enter image description here

    0 讨论(0)
提交回复
热议问题