2011-01-18 30 views
2

コーダー、この問題は私を狂ってしまう!私は過去2日間の広範な研究をしており、何が起こっているのか分かりません。WCF MaxStringContentLengthは決して更新されません!

問題:タイトルによれば、私はSilverlightアプリケーションで消費されるWCFサービスを持っています。問題は、WCF操作の1つを使用しようとすると、次のエラーが表示されることです。

XMLデータの読み取り中に最大文字列コンテンツ長の制限値(8192)を超えました。

web.configのMaxStringContentLengthの値を自分のメッセージサイズに合うものに変更するはずですが、MaxStringContentLengthの値を更新することはシステムに反映されないようです。私はサービス参照を更新しようとしましたが、幸運を払ってソリューション全体を再構築しましたが、同じエラーが発生します。私は何をすべきなのか?

ソリューション情報:WCFフォルダと

  • Asp.netプロジェクト。

  • WCFを使用するSilverlightプロジェクト。

のWeb.config

<system.serviceModel> 
<bindings> 
    <basicHttpBinding> 
    <binding 
     name="BasicHttpBinding_Service1" 
     closeTimeout="00:01:00" 
     openTimeout="00:01:00" 
     receiveTimeout="00:10:00" 
     sendTimeout="00:01:00" 
     allowCookies="false" 
     bypassProxyOnLocal="false" 
     hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="65536" 
     maxBufferPoolSize="524288" 
     maxReceivedMessageSize="65536" 
     messageEncoding="Text" 
     textEncoding="utf-8" 
     transferMode="Buffered" 
     useDefaultWebProxy="true"> 
     <readerQuotas 
     maxDepth="32" 
     maxStringContentLength="10000" 
     maxArrayLength="16384" 
     maxBytesPerRead="4096" 
     maxNameTableCharCount="16384" /> 
     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<client> 
    <endpoint 
    address="http://localhost:53931/WCF/Service1.svc" 
    binding="basicHttpBinding" 
    bindingConfiguration="BasicHttpBinding_Service1" 
    contract="ServiceReference.Service1" 
    name="BasicHttpBinding_Service1" /> 
</client> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name=""> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="false" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

ServiceReferences.ClientConfig

<configuration> 
<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding 
       name="BasicHttpBinding_Service1" 
       maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647" 

       > 
       <security mode="None" /> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint 
      address="http://localhost:53931/WCF/Service1.svc" 
      binding="basicHttpBinding" 
      bindingConfiguration="BasicHttpBinding_Service1" 

      contract="ServiceReference.Service1" 
      name="BasicHttpBinding_Service1" /> 
    </client> 
</system.serviceModel> 

ありがとうございます。

答えて

2

web.configファイル内のどこにでも定義されているサービスは表示されません。そこにはサービスクライアントという定義があります。私はこのサービスもこのように機能することに驚いています。おそらくコピー&ペーストのエラーですか?ここで

は(あなたがマークされた部分が欠落している)同様のシナリオのための私のweb.configです:

<system.serviceModel> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="MyDefaultBehavior"> 
       <serviceMetadata httpGetEnabled="true" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="MyDefaultBinding" allowCookies="true" maxReceivedMessageSize="20000000" maxBufferSize="20000000"> 
       <readerQuotas maxDepth="500" maxArrayLength="20000000" maxStringContentLength="20000000"/> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> <!-- This appears missing from your web.config --> 
     <service behaviorConfiguration="MyDefaultBehavior" name="MyProject.MyService"> 
      <endpoint address="" binding="basicHttpBinding" contract="MyProject.IMyService" bindingConfiguration="MyDefaultBinding" /> 
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
</system.serviceModel> 
+0

http://msdn.microsoft.com/en-us/library/ms733932.aspxによると、 、 ".NET Framework 4の簡略化された構成モデルから始まるこの[services]セクションはオプションです。"とにかく、私はこのタグを追加し、それに応じてそれを設定しなければならないと思います。 – ealshabaan

+1

@alalshabaan:変更を加えない場合はオプションです。あなたのweb configはクライアント部分を設定しますが、サービス部分を設定する必要があります。 –

関連する問題