4

XElement オブジェクトをパラメーターとして受け取る WCF Web MEthod があります。私の XML ファイルの 1 つ (サイズが 600KB 程度) では問題なく動作しますが、この大きな XML ファイル (約 5MB) ではすぐに CommunicationException が発生します。

バインディングのメッセージ サイズを既に大きくしました。以下は、私の web.config の ServiceModel セクションです。

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="BIMIntegrationWS.metadataBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>        

<bindings>
  <customBinding>        
    <binding name="BIMIntegrationWS.IntegrationService.customBinding0"
      closeTimeout="00:01:00" openTimeout="00:01:00"
      receiveTimeout="00:10:00" sendTimeout="00:10:00">
      <binaryMessageEncoding>
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      </binaryMessageEncoding>
      <httpTransport  maxBufferPoolSize="2147483647"   maxBufferSize="2147483647"
                      maxReceivedMessageSize="2147483647" />
    </binding>
  </customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>      
  <service name="BIMIntegrationWS.BIMIntegrationWS" behaviorConfiguration="BIMIntegrationWS.metadataBehavior">
    <endpoint address="" binding="customBinding" bindingConfiguration="BIMIntegrationWS.IntegrationService.customBinding0"
     contract="BIMIntegrationWS.IBIMIntegrationService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
</system.serviceModel>

クライアントでは、ClientConfig は次のようになります。

<system.serviceModel>      
      <bindings>
            <customBinding>                
                  <binding name="CustomBinding_IBIMIntegrationService">
                    <binaryMessageEncoding />
                    <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />                                       
                  </binding>
            </customBinding>
      </bindings>        
    <client>          
        <endpoint address="http://localhost:1895/IntegrationService.svc"
            binding="customBinding" bindingConfiguration="CustomBinding_IBIMIntegrationService"
            contract="BIMIntegrationService.IBIMIntegrationService" name="customBindingEndpoint" />
    </client>
</system.serviceModel>

前もって感謝します!

4

4 に答える 4

1

<readerQuotas />おそらく、 のサブ要素の属性の値を変更する必要があります<binaryMessageEncoding />

詳細については、次を参照してください。 http://msdn.microsoft.com/en-us/library/ms731325.aspx http://forums.silverlight.net/forums/p/88704/205040.aspx

更新:ここmaxAllowedContentLengthで説明されているように 、

于 2010-08-06T18:40:41.137 に答える
1

サービス アプリケーションの web.config に次のスニペットを追加してみてください。

  <system.web>
    <httpRuntime maxRequestLength="16384" /> <!-- 16MB -->
  </system.web>

Web サーバーでサービスをホストする場合、Web サーバーの許可される要求サイズも微調整する必要があります。

よろしく、ラディスラフ

于 2010-08-14T20:31:14.183 に答える
1

おそらく、XElement にノード/子要素が多すぎるため、dataContractSerializer の下の maxItemsInObjectGraph 属性をより大きな値に設定する必要がありますか?

于 2010-08-12T22:47:20.740 に答える
0

VS ホストをオフにし、IIS に展開して ping を送信する方法を知っていますか。開発ボックスの通常の IIS 7 は問題なく動作します。デバッガーなどを接続することはできますが、F5 キーを押してもすぐには満足できませんが、起動時に ocode が死んでいないため、とにかく最初の行からかどうかを確認する必要はありません :-)

非常に早い段階でアタッチする必要がある場合は、何も触れずにint constnatを返すだけの最小限のメソッドを作成できます-アタッチできるようにアプリプールを起動するだけです。

于 2010-08-14T03:39:34.547 に答える