6

我使用 ClickOnce 发布 Windows 窗体应用程序。考虑到这个应用程序的整体大小,安装是相当大的。它超过 15 MB。如果我压缩本地构建的应用程序,它会被压缩到 2.5 MB。

可以以某种方式压缩 ClickOnce 部署吗?

如果没有,是否有人使用 IIS 压缩来加快传输速度?那会有帮助吗?

4

3 回答 3

10

据我所知,您无法真正手动压缩程序集。但是,您绝对可以使用 IIS 压缩。从我对带宽监视器的测试来看,它有很大的不同。一旦设置好,您就不必考虑它,它会自动发生。

我很惊讶这不是经常被谈论的。几年前当我想这样做时,我几乎找不到关于它的信息。但是,如果您正在运行 IIS 6.0,本文应该详细说明您需要进行的所有更改。我不确定这些指令对于更高版本的 IIS 会有多大不同。

于 2009-02-05T14:45:21.570 回答
4

ClickOnce 没有任何内置的压缩​​支持。但是您可以在 Web 服务器级别使用 HTTP 压缩。

按照以下步骤在IIS7下启用压缩:

%windir%\system32\inetsrv\config\applicationHost.config (见我的评论,其他行是默认的)

<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>

还是行不通??将此添加到同一个文件中(默认情况下,IIS 7.0 不会压缩文件,除非它们是“经常请求的”)

<serverRuntime frequentHitTimePeriod="00:00:59" />
于 2011-02-23T06:59:53.137 回答
2

这些说明与更高版本的 IIS 相同。这种压缩工作非常快(它在后台完成,只有一次,直到文件被更改)

于 2009-06-30T07:32:39.213 回答