【问题标题】:Compression in WebApi hosted on AzureAzure 上托管的 WebApi 中的压缩
【发布时间】:2015-07-02 10:50:20
【问题描述】:

我的 Web Api 托管在 AzureWebsites 上,并通过 Azure Api 管理公开。我只是想知道在这种情况下如何启用压缩?会是 azurewebsites 上的东西,还是应该通过 Api 管理门户和 HOW 来完成?

【问题讨论】:

    标签: asp.net asp.net-web-api azure-web-app-service http-compression azure-api-management


    【解决方案1】:

    这应该在每个 IIS 兼容主机上启用 gzip:

    <system.webServer>
        <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
          <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
          <dynamicTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="application/*" enabled="true" />
            <add mimeType="*/*" enabled="false" />
          </dynamicTypes>
          <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="application/*" enabled="true" />
            <add mimeType="*/*" enabled="false" />
          </staticTypes>
        </httpCompression>
        <urlCompression doStaticCompression="true" doDynamicCompression="true" />
    </system.webServer>
    

    【讨论】:

    • 太好了,谢谢。它在 AzureApi 管理代理后面是否仍然有效
    • 如何在 WinForm 应用程序中解压?
    • @InTheWorldOfCodingApplications 只要您在桌面/控制台应用程序中运行,就会自动进行解压缩。 WinInet 为你做这件事msdn.microsoft.com/en-us/library/windows/desktop/…
    • 这在本地对我不起作用。 gzip 文件不可用。以下示例确实有效:brandonmartinez.com/2015/08/20/…
    猜你喜欢
    • 2015-01-27
    • 2016-12-19
    • 2012-05-12
    • 1970-01-01
    • 2014-08-21
    • 2012-08-09
    • 1970-01-01
    • 2020-12-06
    • 2011-02-12
    相关资源
    最近更新 更多