I have a Silverlight application in which I would like to call a WCF service. When calling the service I receive the following response from the server:
415 Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8
Has anyone experienced this problem before? Does anyone know which configuration settings I need to adjust? Any information on how to fix this would be appreciated.
Well, you could try using the "Silverlight-enabled WCF Service" template in VS2008, and comparing the differences? I expect that you need to use the basicHttpBinding
and are using something more exotic.
For info, here is the web.config section for a default Silverlight/WCF service:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MySite.Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="MySite.Service1Behavior"
name="MySite.Service1">
<endpoint address="" binding="basicHttpBinding"
contract="MySite.Service1" />
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>