I am building test WCF Service (PersonService) in .NET 4.5 hosted on IIS 8 express. I also have installed dynamic compression on IIS. As far as I know WCF 4.0 onward compression is enabled by default. To enable httpCompression at service I have updated Web.Config as follows:
<?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>
Question: I want to verify whether the compression is actually happening or not. How can I verify that response is being compressed at server side before sending, also it is getting decompressed at client side.
Note: My client application is also .NET console application which is consuming above service. Both application Service and client running on same machine.
I used Teleric Fiddler check whether compression is happening or not. I have tried following things to check in which situation compression should work and where not. And fiddler didn't disappoint me.
<urlCompression doDynamicCompression="false" />
it should not compress the dynamic response.<urlCompression doDynamicCompression="true" />
, it should compress in any case unless <httpTransport decompressEnabled="false" />
is set. basicHttpBinding
always send Accept-encoding="gzip,deflat"
to server, to disable compression, we need to creating customBinding
and set above property false.