2

コーダー、この問題は私を夢中にさせています!! 私は過去 2 日間、広範な調査を行ってきましたが、何が起こっているのかわかりません。

問題:タイトルが示すように、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>

前もって感謝します。

4

1 に答える 1

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>
于 2011-01-18T05:58:41.473 に答える