2011-06-25 19 views
2

WCFサービスを通じて64kb以上のデータを渡す必要があります。WCFサービスを通じて大量のデータ(64kb以上)を転送する

<services> 
    <service name="MyService" behaviorConfiguration="MyServiceBehavior" > 
    <endpoint address="" binding="customBinding" contract="MyContract" 
     bindingName="testBinding" bindingConfiguration="testBinding" /> 
    <endpoint address="mex" binding="customBinding" contract="IMetadataExchange" 
     bindingName="testBinding" bindingConfiguration="testBinding" /> 
    </service> 
</services> 

<bindings> 
    <customBinding> 
    <binding name="testBinding" > 
     <textMessageEncoding> 
     <readerQuotas maxDepth="2147483647" 
      maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" 
      maxBytesPerRead="2147483647" 
      maxNameTableCharCount="2147483647" /> 
     </textMessageEncoding> 
     <httpTransport transferMode="Buffered" 
     maxReceivedMessageSize="2147483647" 
     maxBufferSize="2147483647"/> 
    </binding> 
    </customBinding> 
</bindings> 

とクライアント側(つまり、サービスを消費):

<client> 
    <endpoint address="http://localhost:82/MyService.svc" 
    binding="customBinding" bindingConfiguration="testBinding" 
    contract="MyContract" 
    name="MyName" /> 
</client> 

<bindings> 
    <customBinding> 
    <binding name="testBinding" > 
     <textMessageEncoding> 
     <readerQuotas maxDepth="2147483647" 
      maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" 
      maxBytesPerRead="2147483647" 
      maxNameTableCharCount="2147483647" /> 
     </textMessageEncoding> 
     <httpTransport transferMode="Buffered" 
     maxReceivedMessageSize="2147483647" 
     maxBufferSize="2147483647"/> 
    </binding> 
    </customBinding> 
</bindings> 

私は「必要なメソッドを呼び出したときに、私は次のように(WCFサービスをホスト)サーバー側を設定したことを行うために、次のエラーが表示されました:

Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:82/MyService.svc . The client and service bindings may be mismatched.

私のバインディングにはどのような不一致がありますか?

ありがとうございました。

答えて

2

あなたはあまりにもいくつかのステップをやっているようです - あまりにも複雑です。既存のバインディングに基づいてバインディング構成を使用するだけでいいのですか?このようなもの:

<bindings> 
    <basicHttpBinding> 
    <binding name="largeBinding" 
      maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
     <readerQuotas 
      maxArrayLength="2147483647" maxBytesPerRead="2147483647" 
      maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" /> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<services> 
    <service name="MyService" behaviorConfiguration="MyServiceBehavior" > 
    <endpoint 
     address="" 
     binding="basicHttpBinding" 
     bindingConfiguration="largeBinding" 
     contract="MyContract" /> 
    <endpoint 
     address="mex" 
     binding="mexHttpBinding" 
     contract="IMetadataExchange" /> 
    </service> 
</services> 

クライアント側で全く同じバインディング設定を定義し、それにも使用します。メタデータ交換のためにも

、あなたの MEXエンドポイントNEVERは、特別な設定を持っている必要があります - 単にデフォルト mexHttpBindingを使用し、そのための任意のバインディングの構成を設定しないでください。

+0

実際、WSDLとしてメタデータを提供したい場合は、mexエンドポイントが必要ありません。serviceMetadataビヘイビアでhttpGetEnabled = true(およびもしあなたがいなければhttpGetUrl、ベースアドレスを持つ)を設定するだけです –

0

サーバー構成ファイルのサービス名がのサービスの完全修飾名(<system.serviceModel/services/service>要素のname属性)と一致することを確認してください。一致しない場合、WCFはバインディングがbasicHttpBinding(およびクライアントが送信しているものとは異なると予想されるコンテンツタイプ)のバインドを持つデフォルトのエンドポイントを提供します。

+0

これは該当しません。ありがとう。 – Budda

関連する問題