Can ClickOnce deployed application setup be compressed?

一个人想着一个人 提交于 2019-11-29 07:12:58

As far as I know, you can't really manually compress your assemblies. However, you absolutely can use IIS compression. From my testing with a bandwidth monitor, it makes a significant difference. And once it's set up, you never have to think about it, it just happens automatically.

I'm surprised this isn't talked about more often. When I wanted to do this a few years ago I could find very little information about it. However, this article should detail all the changes you need to make if you're running IIS 6.0. I'm not sure how much different those instructions will be for later versions of IIS.

ClickOnce does not have any built-in compression support. But you can use HTTP-compression at the web-server level.

Follow these steps to enable compression under IIS7:

%windir%\system32\inetsrv\config\applicationHost.config (see my comments, other lines are default)

<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="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="*/*" enabled="false" />
    </dynamicTypes>
    <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <!--HERE! deploy files-->
        <add mimeType="application/octet-stream" enabled="true" />
        <!--HERE! application files-->
        <add mimeType="application/x-ms-application" enabled="true" />
        <!--HERE! manifest files-->
        <add mimeType="application/x-ms-manifest" enabled="true" />
        <add mimeType="*/*" enabled="false" />
    </staticTypes>
</httpCompression>

Still not working?? Add this to the same file (by default IIS 7.0 does not compress files unless they are "frequently requested")

<serverRuntime frequentHitTimePeriod="00:00:59" />

Those instructions are the same for later version of IIS. This compression works pretty fast (it is done in the background and only once until file will be changed)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!