Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在IIS7和x2B上执行测试,以检查WCF响应是否被httpCompression压缩;_Wcf_Iis Express_Http Compression - Fatal编程技术网

如何在IIS7和x2B上执行测试,以检查WCF响应是否被httpCompression压缩;

如何在IIS7和x2B上执行测试,以检查WCF响应是否被httpCompression压缩;,wcf,iis-express,http-compression,Wcf,Iis Express,Http Compression,我正在IIS 8 express上托管的.NET 4.5中构建测试WCF服务(PersonService)。我还在IIS上安装了动态压缩。据我所知,默认情况下启用WCF 4.0向前压缩。为了在服务中启用httpCompression,我更新了Web.Config,如下所示: <?xml version="1.0"?> <configuration> <appSettings> <add key="aspnet:UseTaskFriendly

我正在IIS 8 express上托管的.NET 4.5中构建测试WCF服务(PersonService)。我还在IIS上安装了动态压缩。据我所知,默认情况下启用WCF 4.0向前压缩。为了在服务中启用httpCompression,我更新了Web.Config,如下所示:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.webServer>
    <httpCompression>
      <dynamicTypes>
        <add mimeType="application/soap+xml" enabled="true"/>
        <add mimeType="application/soap+xml; charset=utf-8" enabled="true"/>
        <add mimeType="application/soap+xml; charset=ISO-8895-1" enabled="true"/>
      </dynamicTypes>
    </httpCompression>
    <urlCompression doDynamicCompression="true" doStaticCompression="true"/>
  </system.webServer>
   <system.serviceModel>
    <services>
      <service name="PersonServiceLibirary.PersonService">
        <endpoint address="" binding="basicHttpBinding" contract="PersonServiceLibirary.IPersonService">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>
     <bindings>
       <basicHttpBinding>
         <binding maxBufferPoolSize="524288000" maxBufferSize="524288000" maxReceivedMessageSize="524288000">

         </binding>
       </basicHttpBinding>
     </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>

问题:我想验证压缩是否实际发生。如何在发送之前验证响应是否在服务器端被压缩,以及它是否在客户端被解压缩

注意:我的客户端应用程序也是使用上述服务的.NET控制台应用程序。应用程序服务和客户端都在同一台机器上运行。

我使用它来检查压缩是否发生。我尝试了以下方法来检查压缩在哪种情况下有效,在哪种情况下无效。小提琴手也没有让我失望

  • 时,不应压缩动态响应
  • 时,在任何情况下都应压缩,除非设置了
    basicHttpBinding
    始终将
    Accept encoding=“gzip,deflat”
    发送到服务器,要禁用压缩,我们需要创建
    customBinding
    并将上述属性设置为false
    1) 使用telnet模拟请求并查看数据是否可读,或者2)使用数据包嗅探器检查TCP包内容。@norbert van noblemen我怎么做?你能给我指一些文章或参考资料吗。我以前没做过