【问题标题】:Web.config transform applies partiallyWeb.config 转换部分适用
【发布时间】:2016-12-10 04:47:58
【问题描述】:

在我的 web.Release.config 中,我定义了三个转换:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
  </system.web>
  <system.webServer>
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" xdt:Transform="SetAttributes" xdt:Locator="Match(directory)">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" xdt:Transform="SetAttributes" xdt:Locator="Match(dll)" />
    </httpCompression>
  </system.webServer>
</configuration>

应用/发布的预览转换都显示只有编译标签正在被转换。

不明白为什么 httpCompression / scheme 标签保持不变?

以下是原始 web.config 内容的摘录:

<httpCompression directory="%TEMP%\iisexpress\IIS Temporary Compressed Files">
  <scheme name="gzip" dll="%IIS_BIN%\gzip.dll" />
  <staticTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="image/svg+xml" enabled="true" />
    <add mimeType="application/javascript" enabled="true" />
    <add mimeType="text/javascript" enabled="true" />
    <add mimeType="application/javascript; charset=utf-8" enabled="true" />
    <add mimeType="application/atom+xml" enabled="true" />
    <add mimeType="application/xaml+xml" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </staticTypes>
</httpCompression>

【问题讨论】:

    标签: asp.net visual-studio msbuild web-deployment


    【解决方案1】:

    @lexeme 你的代码不正确。请尝试以下代码:

     <system.webServer>
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" xdt:Transform="SetAttributes">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
    </httpCompression>
    

    【讨论】:

    • 这是真的。上帝保佑你;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-17
    • 1970-01-01
    • 2013-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多