Home > OS >  .NET 5 - Uploading large files - Azure App Services
.NET 5 - Uploading large files - Azure App Services

Time:10-08

To allow large file upload, below config is required in web.config plus other api level configs if any.

.NET 5/Core doesnt have web.config at the time of development.

Is there any way to write below config to web.config via azure devops pipelines / any automated way ? direct configuration in the azure app service is not an options we deploy the code many times in a week.

  <configuration>
<system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="500000000" />
      </requestFiltering>
    </security>
<system.webServer>

CodePudding user response:

Initially .NET 5/Core doesnt have web.config at the time of development , but after deployment web.config will be generated in your Azure App. You can view your files in Portal.

  1. In the Azure Portal, navigate to the web app.
  2. In the App Service blade, enter kudu in the search box.
  3. Select Advanced Tools > Go.
  4. Select Debug console > CMD.
  5. Navigate to site/wwwroot
  6. Select the pencil icon to edit the web.config file.

enter image description here

CodePudding user response:

To edit your web.config in your CI/CD pipeline, I would recommend taking a look at the File Transform task, which uses XML transformations.

XML transformations are a pain in my opinion, however, so you could also opt for doing a simple file overwrite using Powershell if you just want to set your web.config to the contents above.

Also - why not just include the web.config file in your repository? That way, you won't need any CI tasks if you just want a static file & it'll work as expected.

  • Related