0

我在 IIS 10 上运行一个静态网站。

我想httpCompression在站点级别禁用 brotli 以验证我的站点级别配置是否确实有效,并且无论全局文件httpCompression如何,我都会在每台机器上获得所需的结果。applicationHost.config

据我了解,通过使用<clear />我删除所有全局规则并添加我的本地规则以应用于网站。所以,如果我使用<clear />然后添加<scheme name="gzip" ... />它意味着网站应该只使用 gzip 压缩。

但实际上,它仍然使用brotli。即使我手动删除缓存(IIS 压缩缓存和浏览器缓存)并重新启动服务器。

我可以在 IIS GUI 中看到: IIS GUI 配置

这是我的C:\Windows\System32\inetsrv\config\applicationHost.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <configSections>
        <sectionGroup name="system.applicationHost">
            <section name="applicationPools" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="configHistory" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="customMetadata" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="listenerAdapters" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="log" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="serviceAutoStartProviders" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="sites" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="webLimits" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
        </sectionGroup>

        <sectionGroup name="system.webServer">
            <section name="asp" overrideModeDefault="Deny" />
            <section name="caching" overrideModeDefault="Allow" />
            <section name="cgi" overrideModeDefault="Deny" />
            <section name="defaultDocument" overrideModeDefault="Allow" />
            <section name="directoryBrowse" overrideModeDefault="Allow" />
            <section name="fastCgi" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="globalModules" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
            <section name="handlers" overrideModeDefault="Deny" />
            <section name="httpCompression" allowDefinition="Everywhere" overrideModeDefault="Allow" />
            <section name="httpErrors" overrideModeDefault="Allow" />
            <section name="httpLogging" overrideModeDefault="Deny" />
            <section name="httpProtocol" overrideModeDefault="Allow" />
            <section name="httpRedirect" overrideModeDefault="Allow" />
            <section name="httpTracing" overrideModeDefault="Deny" />
            <section name="isapiFilters" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
            <section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
            <section name="applicationInitialization" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
            <section name="odbcLogging" overrideModeDefault="Deny" />
            <sectionGroup name="security">
                <section name="access" overrideModeDefault="Deny" />
                <section name="applicationDependencies" overrideModeDefault="Deny" />
                <sectionGroup name="authentication">
                    <section name="anonymousAuthentication" overrideModeDefault="Deny" />
                    <section name="basicAuthentication" overrideModeDefault="Deny" />
                    <section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" />
                    <section name="digestAuthentication" overrideModeDefault="Deny" />
                    <section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" />
                    <section name="windowsAuthentication" overrideModeDefault="Deny" />
                </sectionGroup>
                <section name="authorization" overrideModeDefault="Allow" />
                <section name="ipSecurity" overrideModeDefault="Deny" />
                <section name="dynamicIpSecurity" overrideModeDefault="Deny" />
                <section name="isapiCgiRestriction" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
                <section name="requestFiltering" overrideModeDefault="Allow" />
            </sectionGroup>
            <section name="serverRuntime" overrideModeDefault="Deny" />
            <section name="serverSideInclude" overrideModeDefault="Deny" />
            <section name="staticContent" overrideModeDefault="Allow" />
            <sectionGroup name="tracing">
                <section name="traceFailedRequests" overrideModeDefault="Allow" />
                <section name="traceProviderDefinitions" overrideModeDefault="Deny" />
            </sectionGroup>
            <section name="urlCompression" overrideModeDefault="Allow" />
            <section name="validation" overrideModeDefault="Allow" />
            <sectionGroup name="webdav">
                <section name="globalSettings" overrideModeDefault="Deny" />
                <section name="authoring" overrideModeDefault="Deny" />
                <section name="authoringRules" overrideModeDefault="Deny" />
            </sectionGroup>
            <section name="webSocket" overrideModeDefault="Deny" />
            <sectionGroup name="externalCache">
                <section name="diskCache" overrideModeDefault="Allow" />
            </sectionGroup>
            <section name="proxy" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
            <section name="diskCache" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
            <sectionGroup name="rewrite">
                <section name="globalRules" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
                <section name="rules" overrideModeDefault="Allow" />
                <section name="outboundRules" overrideModeDefault="Allow" />
                <section name="providers" overrideModeDefault="Allow" />
                <section name="rewriteMaps" overrideModeDefault="Allow" />
                <section name="allowedServerVariables" overrideModeDefault="Deny" />
            </sectionGroup>
        </sectionGroup>
        <sectionGroup name="system.ftpServer">
            <section name="log" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
            <section name="firewallSupport" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
            <section name="caching" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
            <section name="providerDefinitions" overrideModeDefault="Deny" />
            <sectionGroup name="security">
                <section name="ipSecurity" overrideModeDefault="Deny" />
                <section name="requestFiltering" overrideModeDefault="Deny" />
                <section name="authorization" overrideModeDefault="Deny" />
                <section name="authentication" overrideModeDefault="Deny" />
            </sectionGroup>
            <section name="serverRuntime" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
        </sectionGroup>
        <section name="webFarms" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
    </configSections>

    <configProtectedData>
        <providers>
            <add name="IISCngProvider" type="Microsoft.ApplicationHost.CngProtectedConfigurationProvider" description="Uses Win32 Crypto CNG to encrypt and decrypt" keyContainerName="iisCngConfigurationKey" useMachineContainer="true" />
            <add name="IISWASOnlyCngProvider" type="Microsoft.ApplicationHost.CngProtectedConfigurationProvider" description="(WAS Only) Uses Win32 Crypto CNG to encrypt and decrypt" keyContainerName="iisCngWasKey" useMachineContainer="true" />
        </providers>
    </configProtectedData>

    <system.applicationHost>

        <applicationPools>
            <add name="DefaultAppPool" />
            <add name="BWW" />
            <applicationPoolDefaults managedRuntimeVersion="v4.0">
                <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="false" />
            </applicationPoolDefaults>
        </applicationPools>

        <customMetadata />

        <listenerAdapters>
            <add name="http" />
        </listenerAdapters>

        <log>
            <centralBinaryLogFile enabled="true" directory="%SystemDrive%\inetpub\logs\LogFiles" />
            <centralW3CLogFile enabled="true" directory="%SystemDrive%\inetpub\logs\LogFiles" />
        </log>

        <sites>
            <site name="Default Web Site" id="1" serverAutoStart="true">
                <application path="/">
                    <virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
                </application>
                <bindings>
                    <binding protocol="https" bindingInformation="*:8585:privat" sslFlags="0" />
                </bindings>
                <traceFailedRequestsLogging enabled="true" />
            </site>
            <site name="BWW" id="2" serverAutoStart="true">
                <application path="/" applicationPool="BWW">
                    <virtualDirectory path="/" physicalPath="C:\Users\maxim\OneDrive\Documents\dist" userName="maxim" password="[enc:IISCngProvider:Yd3HfOPpgLt0275jDLCqSJ+elx5f0pFez1NZ2Xiy4ips8kgq/hOHdO7EbBNvLkkuvkxcEu7F/6pbfWPlbbPAunzzrMEsdWSuTamrYZkC+p8=:enc]" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:3080:" />
                </bindings>
            </site>
            <siteDefaults>
                <logFile logFormat="W3C" directory="%SystemDrive%\inetpub\logs\LogFiles" />
                <traceFailedRequestsLogging directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" />
            </siteDefaults>
            <applicationDefaults applicationPool="DefaultAppPool" />
            <virtualDirectoryDefaults allowSubDirConfig="true" />
        </sites>

        <webLimits />

    </system.applicationHost>

    <system.webServer>

        <asp />

        <caching enabled="true" enableKernelCache="true">
        </caching>

        <cgi />

        <defaultDocument enabled="true">
            <files>
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
            </files>
        </defaultDocument>

        <directoryBrowse enabled="false" />

        <fastCgi />

        <globalModules>
            <add name="HttpLoggingModule" image="%windir%\System32\inetsrv\loghttp.dll" />
            <add name="UriCacheModule" image="%windir%\System32\inetsrv\cachuri.dll" />
            <add name="FileCacheModule" image="%windir%\System32\inetsrv\cachfile.dll" />
            <add name="TokenCacheModule" image="%windir%\System32\inetsrv\cachtokn.dll" />
            <add name="HttpCacheModule" image="%windir%\System32\inetsrv\cachhttp.dll" />
            <add name="StaticCompressionModule" image="%windir%\System32\inetsrv\compstat.dll" />
            <add name="DefaultDocumentModule" image="%windir%\System32\inetsrv\defdoc.dll" />
            <add name="DirectoryListingModule" image="%windir%\System32\inetsrv\dirlist.dll" />
            <add name="ProtocolSupportModule" image="%windir%\System32\inetsrv\protsup.dll" />
            <add name="StaticFileModule" image="%windir%\System32\inetsrv\static.dll" />
            <add name="AnonymousAuthenticationModule" image="%windir%\System32\inetsrv\authanon.dll" />
            <add name="BasicAuthenticationModule" image="%windir%\System32\inetsrv\authbas.dll" />
            <add name="WindowsAuthenticationModule" image="%windir%\System32\inetsrv\authsspi.dll" />
            <add name="RequestFilteringModule" image="%windir%\System32\inetsrv\modrqflt.dll" />
            <add name="CustomErrorModule" image="%windir%\System32\inetsrv\custerr.dll" />
            <add name="CustomLoggingModule" image="%windir%\System32\inetsrv\logcust.dll" />
            <add name="TracingModule" image="%windir%\System32\inetsrv\iisetw.dll" />
            <add name="FailedRequestsTracingModule" image="%windir%\System32\inetsrv\iisfreb.dll" />
            <add name="RequestMonitorModule" image="%windir%\System32\inetsrv\iisreqs.dll" />
            <add name="ApplicationRequestRouting" image="%ProgramFiles%\IIS\Application Request Routing\requestRouter.dll" />
            <add name="RewriteModule" image="%SystemRoot%\system32\inetsrv\rewrite.dll" />
            <add name="DynamicCompressionModule" image="%windir%\System32\inetsrv\compdyn.dll" />
        </globalModules>

        <handlers accessPolicy="Read, Script">
            <add name="TRACEVerbHandler" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" />
            <add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" />
            <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
        </handlers>

        <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
            <scheme name="br" dll="%ProgramFiles%\IIS\IIS Compression\iisbrotli.dll" />
            <scheme name="gzip" dll="%ProgramFiles%\IIS\IIS Compression\iiszlib.dll" />
            <staticTypes>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/javascript" enabled="true" />
                <add mimeType="application/atom+xml" enabled="true" />
                <add mimeType="application/xaml+xml" enabled="true" />
                <add mimeType="image/svg+xml" enabled="true" />
                <add mimeType="*/*" enabled="false" />
            </staticTypes>
            <dynamicTypes>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="application/javascript" enabled="true" />
                <add mimeType="*/*" enabled="false" />
            </dynamicTypes>
        </httpCompression>

        <httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
            <error statusCode="401" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="401.htm" />
            <error statusCode="403" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="403.htm" />
            <error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="404.htm" />
            <error statusCode="405" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="405.htm" />
            <error statusCode="406" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="406.htm" />
            <error statusCode="412" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="412.htm" />
            <error statusCode="431" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="431.htm" />
            <error statusCode="500" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="500.htm" />
            <error statusCode="501" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="501.htm" />
            <error statusCode="502" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="502.htm" />
        </httpErrors>

        <httpLogging dontLog="false" />

        <httpProtocol>
            <customHeaders>
                <clear />
            </customHeaders>
            <redirectHeaders>
                <clear />
            </redirectHeaders>
        </httpProtocol>

        <httpRedirect />

        <httpTracing>
        </httpTracing>

        <isapiFilters />

        <modules>
            <add name="BasicAuthenticationModule" lockItem="true" />
            <add name="HttpLoggingModule" lockItem="true" />
            <add name="HttpCacheModule" lockItem="true" />
            <add name="StaticCompressionModule" lockItem="true" />
            <add name="DefaultDocumentModule" lockItem="true" />
            <add name="DirectoryListingModule" lockItem="true" />
            <add name="ProtocolSupportModule" lockItem="true" />
            <add name="StaticFileModule" lockItem="true" />
            <add name="AnonymousAuthenticationModule" lockItem="true" />
            <add name="WindowsAuthenticationModule" lockItem="true" />
            <add name="RequestFilteringModule" lockItem="true" />
            <add name="CustomErrorModule" lockItem="true" />
            <add name="CustomLoggingModule" lockItem="true" />
            <add name="FailedRequestsTracingModule" lockItem="true" />
            <add name="ApplicationRequestRouting" />
            <add name="RewriteModule" />
            <add name="DynamicCompressionModule" lockItem="true" />
        </modules>

        <odbcLogging />

        <security>

            <access sslFlags="None" />

            <applicationDependencies />

            <authentication>

                <anonymousAuthentication enabled="true" userName="IUSR" />

                <basicAuthentication enabled="false" />

                <clientCertificateMappingAuthentication />

                <digestAuthentication />

                <iisClientCertificateMappingAuthentication />

                <windowsAuthentication enabled="false" authPersistNonNTLM="true">
                    <providers>
                        <add value="Negotiate" />
                        <add value="NTLM" />
                    </providers>
                </windowsAuthentication>

            </authentication>

            <authorization />

            <ipSecurity />

            <isapiCgiRestriction />

            <requestFiltering>
                <fileExtensions allowUnlisted="true" applyToWebDAV="true" />
                <verbs allowUnlisted="true" applyToWebDAV="true" />
                <hiddenSegments applyToWebDAV="true">
                    <add segment="web.config" />
                </hiddenSegments>
            </requestFiltering>

        </security>

        <serverSideInclude />

        <staticContent lockAttributes="isDocFooterFileName">
            <mimeMap fileExtension=".323" mimeType="text/h323" />
            <!-- ... and so on -->
        </staticContent>

        <tracing>

            <traceFailedRequests />

            <traceProviderDefinitions>
                <add name="WWW Server" guid="{3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}">
                    <areas>
                        <clear />
                        <add name="Authentication" value="2" />
                        <add name="Security" value="4" />
                        <add name="Filter" value="8" />
                        <add name="StaticFile" value="16" />
                        <add name="CGI" value="32" />
                        <add name="Compression" value="64" />
                        <add name="Cache" value="128" />
                        <add name="RequestNotifications" value="256" />
                        <add name="Module" value="512" />
                        <add name="FastCGI" value="4096" />
                        <add name="WebSocket" value="16384" />
                        <add name="RequestRouting" value="2048" />
                        <add name="Rewrite" value="1024" />
                    </areas>
                </add>
                <add name="ASP" guid="{06b94d9a-b15e-456e-a4ef-37c984a2cb4b}">
                    <areas>
                        <clear />
                    </areas>
                </add>
                <add name="ISAPI Extension" guid="{a1c2040e-8840-4c31-ba11-9871031a19ea}">
                    <areas>
                        <clear />
                    </areas>
                </add>
            </traceProviderDefinitions>

        </tracing>

        <urlCompression />

        <validation />
        <diskCache>
            <compression>
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="application/javascript" enabled="true" />
            </compression>
        </diskCache>
        <proxy enabled="true" />

    </system.webServer>
    <location path="Default Web Site">
        <system.webServer>
            <security>
                <access sslFlags="None" />
            </security>
        </system.webServer>
    </location>
    <webFarms>
        <applicationRequestRouting>
            <hostAffinityProviderList>
                <add name="Microsoft.Web.Arr.HostNameRoundRobin" />
            </hostAffinityProviderList>
        </applicationRequestRouting>
    </webFarms>
    <location path="" overrideMode="Allow">
        <system.webServer>
        </system.webServer>
    </location>
    <location path="" overrideMode="Deny">
        <system.webServer>

            <serverRuntime />
        </system.webServer>
    </location>

</configuration>

这是我的Web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <!-- You have to manually enable Windows Feature "World Wide Web Services\Performance\Static Content Compression" and "Dynamic Content Compression" -->
        <!-- Also, install https://www.iis.net/downloads/microsoft/iis-compression -->
        <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" minFileSizeForComp="1" staticCompressionIgnoreHitFrequency="true">
            <clear />
            <!-- <scheme name="br" dll="%ProgramFiles%\IIS\IIS Compression\iiszlib.dll" doStaticCompression="false" doDynamicCompression="false"/> -->
            <scheme name="gzip" dll="%ProgramFiles%\IIS\IIS Compression\iiszlib.dll" doStaticCompression="true" doDynamicCompression="true" staticCompressionLevel="10" dynamicCompressionLevel="10" />
            <dynamicTypes>
                <!-- We need to enable dynamic compresssion even though we don't serve dynamic content, because IIS seems to consider small files dynamic. This happened to our account.css file -->
                <clear />
                <add mimeType="*/*" enabled="true" />
            </dynamicTypes>
            <staticTypes>
                <clear />
                <add mimeType="*/*" enabled="true" />
            </staticTypes>
        </httpCompression>
        <!-- You have to manually install https://www.iis.net/downloads/microsoft/application-request-routing and https://www.iis.net/downloads/microsoft/url-rewrite;
        Then go to IIS -> URL Rewrite -> Add Rules and attempt to create reverse proxy rule, it'll prompt you for some permission and you have to allow it, then cancel everything, no need to create rules manually -->
        <rewrite>
            <rules>
                <rule name="ReverseProxyS3" stopProcessing="true">
                    <match url="^s3/(.*)$" />
                    <action type="Rewrite" url="https://bla-bla.bla.bla.amazonaws.com/{R:1}" />
                </rule>
                <rule name="bla/status" stopProcessing="true">
                    <match url="^bla/status$" />
                    <action type="CustomResponse" statusCode="200" statusReason="ok" statusDescription="ok" />
                </rule>
            </rules>
        </rewrite>
        <staticContent>
            <mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
            <mimeMap fileExtension=".properties" mimeType="application/octet-stream" />
        </staticContent>
        <tracing>
            <traceFailedRequests>
                <add path="*">
                    <traceAreas>
                        <add provider="ASP" verbosity="Verbose" />
                        <add provider="ISAPI Extension" verbosity="Verbose" />
                        <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI,WebSocket,RequestRouting,Rewrite" verbosity="Verbose" />
                    </traceAreas>
                    <failureDefinitions statusCodes="100-999" />
                </add>
            </traceFailedRequests>
        </tracing>
    </system.webServer>
    <location path="index.html">
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="DisableCache" cacheControlMaxAge="0.00:00:00" />
            </staticContent>
            <httpProtocol>
                <customHeaders>
                    <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
                    <add name="Pragma" value="no-cache" />
                    <add name="Expires" value="-1" />
                </customHeaders>
            </httpProtocol>
        </system.webServer>
    </location>
    <location path="account/login/index.html">
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="DisableCache" cacheControlMaxAge="0.00:00:00" />
            </staticContent>
            <httpProtocol>
                <customHeaders>
                    <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
                    <add name="Pragma" value="no-cache" />
                    <add name="Expires" value="-1" />
                </customHeaders>
            </httpProtocol>
        </system.webServer>
    </location>
    <location path="account/forgot-password/index.html">
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="DisableCache" cacheControlMaxAge="0.00:00:00" />
            </staticContent>
            <httpProtocol>
                <customHeaders>
                    <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
                    <add name="Pragma" value="no-cache" />
                    <add name="Expires" value="-1" />
                </customHeaders>
            </httpProtocol>
        </system.webServer>
    </location>
    <location path="account/signup/index.html">
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="DisableCache" cacheControlMaxAge="0.00:00:00" />
            </staticContent>
            <httpProtocol>
                <customHeaders>
                    <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
                    <add name="Pragma" value="no-cache" />
                    <add name="Expires" value="-1" />
                </customHeaders>
            </httpProtocol>
        </system.webServer>
    </location>
    <location path="account/activate/index.html">
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="DisableCache" cacheControlMaxAge="0.00:00:00" />
            </staticContent>
            <httpProtocol>
                <customHeaders>
                    <add name="Cache-Control" value="no-cache, no-store, must-revalidate" />
                    <add name="Pragma" value="no-cache" />
                    <add name="Expires" value="-1" />
                </customHeaders>
            </httpProtocol>
        </system.webServer>
    </location>
</configuration>

我试过的:

  • 使用<section name="httpCompression" allowDefinition="Everywhere" overrideModeDefault="Allow" />

  • 使用

    <location path="" overrideMode="Allow">
        <!-- ... -->
    </location>
    <location path="" overrideMode="Allow">
        <!-- ... -->
    </location>
    
  • 在尝试之间运行net stop was /y && net start w3svc,以及在 IIS 中单击“重新启动”

  • <scheme name="br" dll="%ProgramFiles%\IIS\IIS Compression\iiszlib.dll" doStaticCompression="false" doDynamicCompression="false"/>- 明确禁用 brotli

  • 用. <httpCompression>...<httpCompression/>_ <httpCompression />_ applicationHost.config还尝试<httpCompression />applicationHost.config. 在这两种情况下,都发生了压缩,即使它是在Web.config文件中配置的。

也许,我的覆盖权限有问题?

另外,如果我从我的- IIS中httpCompression完全删除部分,它会停止压缩和文件,所以我认为它确实有效。但不知道为什么s 不起作用...是设计使然吗?...Web.configmanifest.webmanifest.png<add mimeType="*/*" enabled="true" /><scheme>

4

0 回答 0