为什么当我在 web.config 中添加 maxAllowedContentLength 时 Azure Web App 没有启动?

问题描述 投票:0回答:1

我正在开发托管在 Azure Web App 上的 ASP.NET 7 WebApi 应用程序。我需要传输大文件。许多资源显示我需要在 web.config 中添加节点,但是当我添加时,我的 azure web 应用程序不会启动。

我的 web.config

<?xml version="1.0" encoding="utf-8"?>

<configuration>
    <location path="." inheritInChildApplications="false">
        <system.webServer>
            <handlers>
                <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
            </handlers>
            <aspNetCore processPath="dotnet" arguments=".\WebApplication1.dll" stdoutLogEnabled="false"
                        stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
            <security>
                <requestFiltering>
                    <requestLimits maxAllowedContentLength="2147483647 " />
                </requestFiltering>
            </security>
        </system.webServer>
    </location>
</configuration>
<!--ProjectGuid: 46edd0a7-6184-47ed-a0e9-d3be7fee8b41-->

当我尝试打开网络应用程序时显示此消息:

如标题:为什么不起作用?我错过了一些步骤吗?

我的 .csproj 文件:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.3" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
  </ItemGroup>

</Project>
azure azure-web-app-service web-config
1个回答
0
投票

正如 AnnaGevel 提到的,我的 web.config 文件中有错字。那是罪魁祸首。

谢谢各位三合会的帮忙

© www.soinside.com 2019 - 2024. All rights reserved.