2012-04-01 13 views
11

私はweb.configファイルを変更し、MaxReceivedMessageSizeプロパティを 私のweb.configに追加する必要がありますが、どこですか?WCFサービスのweb.configファイルにMaxReceivedMessageSizeプロパティを配置する場所は?

受信メッセージ(65536)の最大メッセージサイズクォータが超過しています。クォータを増やすには、適切なバインディング要素でMaxReceivedMessageSizeプロパティを使用します。

<?xml version="1.0"?> 
    <configuration> 
     <system.web> 
     <compilation debug="false"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /></assemblies></compilation> 
     </system.web> 
     <system.serviceModel> 
     <behaviors> 
      <serviceBehaviors> 
      <behavior> 
       <serviceMetadata httpGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="false" /> 
      </behavior> 
      </serviceBehaviors> 
     </behaviors> 
     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
     </system.serviceModel> 
    <system.webServer> 
     <modules runAllManagedModulesForAllRequests="true" /> 
     </system.webServer> 
+0

通常、バインディング要素に設定されます。あなたのweb.configにはWCFサービスの兆候は全く見当たりませんが –

+0

@DmitriyReznik:便利な「デフォルト」のエンドポイントを持つ.NET 4 WCFサービス –

答えて

28

はあなたが結合することを使用するために使用したいと、あなたは(クライアント側で)あなたの(サーバー側)サービスとクライアントを定義する必要が結合するための結合構成を定義する必要があり、バインディングの設定:

<system.serviceModel> 
    <bindings> 
     <!-- pick whichever binding you want .... --> 
     <basicHttpBinding> 
     <!-- binding configuration with a name --> 
     <binding name="ExtendedMaxSize" 
      maxBufferSize="999999" maxReceivedMessageSize="999999" /> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
    <service name="Yournamespace.YourServiceClass" behaviorConfiguration="..."> 
     <!-- define endpoint with your binding and the name of the binding configuration 
      that you have defined just above --> 
     <endpoint address="" 
       binding="basicHttpBinding" 
       bindingConfiguration="ExtendedMaxSize" 
       contract="Yournamespace.IYourServiceContract" /> 
    </service> 
    </services> 
1

私がしたようにここで終わるかもしれない人を助けるために。 私は上記のコメントにまだ追加することはできません(通常、問題が発生する前に誰かがすでに回答を持っています)ので、回答を追加する必要があります。

私はMVC 4アプリを持っていますが、上記の最初のサンプルは実際のWCFサービスプロジェクトのweb.configからのものと思われます。コメントの1つは、それがMVC 4アプリとデフォルトの設定の設定だと思っていると言います。

しかし、どのように問題を解決しますか?より多くの研究から、実際にはCLIENTのweb.config、つまりWCFサービスへの参照を持つプロジェクトのWeb設定に変更を加える必要があるようです。そこに変更を加える方がずっと簡単です。 web.configのそのバージョンは、実際にあなたが探しているものに似ています。

私にとっては簡単に問題が解決しました。

関連する問題