c# - WCF - Binary Encoding over HTTP throwing client and service binding mismatch exception -


the exception:

content type application/soap+msbin1 not supported service http://localhost:1500/myservice.svc. client , service bindings may mismatched.

the client configuration:

  <system.servicemodel>     <bindings>      <custombinding>         <binding name="nethttpbinding" closetimeout="00:01:00"           opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00">           <binarymessageencoding />           <httptransport allowcookies="false" bypassproxyonlocal="false"                          hostnamecomparisonmode="strongwildcard" maxbuffersize="65536"                          maxbufferpoolsize="524288" maxreceivedmessagesize="65536"                          transfermode="buffered" usedefaultwebproxy="true" />         </binding>       </custombinding>      </bindings>     <client>       <endpoint address="http://localhost:1500/myservice.svc"         binding="custombinding" bindingconfiguration="nethttpbinding"         contract="app.bll.imyservicecontract" name="myserviceendpoint" />     </client>   </system.servicemodel> 

the server configuration:

  <system.servicemodel>     <bindings>       <custombinding>         <binding name="nethttpbinding" closetimeout="00:01:00"           opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00">           <binarymessageencoding />           <httptransport allowcookies="false" bypassproxyonlocal="false"                          hostnamecomparisonmode="strongwildcard" maxbuffersize="65536"                          maxbufferpoolsize="524288" maxreceivedmessagesize="65536"                          transfermode="buffered" usedefaultwebproxy="true" />         </binding>       </custombinding>     </bindings>      <services>       <service name="myappservice">         <endpoint address="" binding="custombinding" bindingconfiguration="nethttpbinding"                   contract="app.bll.imyservicecontract">         </endpoint>       </service>     </services>      <behaviors>       <servicebehaviors>         <behavior>           <!-- avoid disclosing metadata information, set value below false , remove metadata endpoint above before deployment -->           <servicemetadata httpgetenabled="true"/>           <!-- receive exception details in faults debugging purposes, set value below true.  set false before deployment avoid disclosing exception information -->           <servicedebug includeexceptiondetailinfaults="true"/>         </behavior>       </servicebehaviors>     </behaviors>      <servicehostingenvironment multiplesitebindingsenabled="true" />    </system.servicemodel> 

you cannot use binarymessageencoding , http without custombindings. can use textmessageencoding or mtommessageencoding out of box.

see blog post reference on using custombindings http transport.

<bindings>     <custombinding>       <binding name="basichttpbinarybinding">         <binarymessageencoding />                      <httptransport />       </binding>     </custombinding> </bindings> 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -