2011-02-04 17 views
5

istisna:WCF - İkili Kodlama HTTP üzerinden atma istemci ve servis bağlama uyumsuzluk istisna

İçerik Türü uygulama/sabun + msbin1 hizmet http://localhost:1500/MyService.svc tarafından desteklenen değildi. İstemci ve hizmet bağlamaları, uyuşmuyor olabilir.

istemci yapılandırma:

<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> 

sunucu yapılandırması:

<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> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="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="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

    </system.serviceModel> 
+0

Servis IIS'de veya başka bir barındırma uygulamasında barındırılıyor mu? –

+0

Şu an için Visual Studio'ya ev sahipliği yaptım. Yerleşik web sunucusu (Adını asla hatırlayamıyorum). Tamamlandığında IIS'ye dağıtacağım. – mbursill

+0

Sunucu [uç nokta ** Sözleşme **] (http://msdn.microsoft.com/en-us/library/system.servicemodel.description.serviceendpoint.contract.aspx) eşleşmiyorsa aynı sorunu yaşadım. son nokta tarafından kullanılan gerçek sözleşme. – SliverNinja

cevap

4

Sen customBindings olmadan binaryMessageEncoding ve HTTP kullanamaz. textMessageEncoding veya mtomMessageEncoding'u kutudan çıkarabilirsiniz.

reference on using customBindings with HTTP transport için bu blog yayına bakın.

<bindings> 
    <customBinding> 
     <binding name="basicHttpBinaryBinding"> 
     <binaryMessageEncoding />    
     <httpTransport /> 
     </binding> 
    </customBinding> 
</bindings> 
+3

Bu, bazı sitelerde okuduğum ile çelişiyor: http://jeffbarnes.net/blog/post/2007/02/22/WCF-Enable-Binary-Encoding-Over-Http.aspx Bir yazınız var mı Bu konuda konuşuyor? – mbursill

+1

HTTP, metin tabanlı bir protokoldür. MTOM, ikili ekleri (eski DIME protokolü) HTTP'ye eklemek için özel olarak tasarlanmıştır. İkili kodlayıcı, bir metin akışı olmayan bir ikili akışı gerektirir. –

+0

@mbursill - Test edilen yetenekleri yansıtacak şekilde cevabı güncelledim. 'CustomBinding' yapılandırmasını kullanarak' application/soap + msbin1' içerik türünü alabilirsiniz. [Jeff Barnes ilanı] (http://jeffbarnes.net/blog/post/2007/02/22/WCF-Enable-Binary-Encoding-Over-Http.aspx) doğrudur. – SliverNinja

İlgili konular