Reputation: 41
Recently I have been having a problem with wcf service calls randomly returning the header 2 times in the message once at the beginning of the message and once at the end of the message. Here is an example of what I am seeing through fiddler:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 16 Feb 2012 15:48:22 GMT
Content-Length: 308
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><Person_UpdateLastCSIDResponse/></s:Body></s:Envelope>HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 126
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
This does not happen all time, but seems to be randomly happening. It isn't happening for just one particular service call, but can happen under any call. I haven't been able to identify a pattern yet.
We are using binding type basicHttpBinding through a load balancer in a silverlight application.
edit:
we have a fairly basic configuration:
service side:
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="silverlightFaults" type="Website.Support.SilverlightFaultBehavior, Website" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="Website.Services.CommonService">
<endpoint address="" behaviorConfiguration="SilverlightFaultBehavior"
binding="basicHttpBinding" bindingConfiguration="MyDefaultBinding"
contract="Website.Services.CommonService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<bindings>
<basicHttpBinding>
<binding name="MyDefaultBinding" maxBufferSize="6500000" maxReceivedMessageSize="6500000">
<readerQuotas maxDepth="32" maxStringContentLength="52428800" maxArrayLength="52428800"
maxBytesPerRead="4096" maxNameTableCharCount="52428800" />
</binding>
</basicHttpBinding>
</bindings>
<client />
</system.serviceModel>
client side:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SecureBinding" maxBufferSize="8388608" maxReceivedMessageSize="8388608">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://Website/Services/CommonService.svc" binding="basicHttpBinding" bindingConfiguration="SecureBinding"
contract="CommonSvcReference.CommonService" name="BasicHttpBinding_CommonService"/>
</client>
</system.serviceModel>
Upvotes: 2
Views: 1465
Reputation: 41
I believe I have finally solved my problem. Since we are using a load balancer you need to have the keep-alive be false. The issue is that BasicHttpBinding has keep-alive as true. Switching to a customBinding allows you to turn off the keep-alive and this solved the problem.
As an extension turning keep-alive as false caused it slow down the application. To solve this I used sample code on http://blog.tonysneed.com/2012/06/18/building-scalable-and-secure-wcf-services/
Upvotes: 2