其他信息:远程服务器返回意外响应:(413)请求实体太大

时间:2017-08-01 13:23:01

标签: c# wcf

我在WCF服务中收到此错误:其他信息:远程服务器返回了意外响应:(413)请求实体太大。

我尝试将maxReceivedMessageSize增加到2147483647,但它仍然无法正常工作。然后,我测量了文件的大小,我意识到它有10 Kb。

你们有什么想法吗?

我发给你一份我的代码:

在这里,我基本上为业务逻辑层(WCF服务)发送了1Kb的列表

  else if (comboBoxReason.Text == "Antecipação indevida - automática")
            {
                AdjustmentAmount = 0;

                using (Stream s = new MemoryStream())
                {
                    BinaryFormatter formatter = new BinaryFormatter();
                    formatter.Serialize(s, AnticipationAdjustment); 
                    long size = s.Length;
                }



                AdjustmentAmount = Decimal.Round(FinancialAdjustmentsCalculations.AnticipationAutomaticRate(AnticipationAdjustment), 2); //THE ERROR IS HERE
                textBoxAdjustment.Text = ValorAjuste.ToString();
                AnticipationAdjustment.Clear();
            }

这是我的Business.Config来自业务逻辑层(Ext)

  <bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IInt" closeTimeout="01:00:01" openTimeout="01:00:01"
             receiveTimeout="02:00:01" sendTimeout="09:00:00" maxBufferPoolSize="2147483647" 
             maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
  </basicHttpBinding>

这是我在界面上的App.Config:

         <binding name="BasicHttpBinding_IExt"
      closeTimeout="01:00:01"
    openTimeout="01:00:01" receiveTimeout="02:00:01" sendTimeout="09:00:00"
    maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
        </basicHttpBinding>

我尝试添加readerQuotas和maxItemsInObjectGraph =&#34; 2147483647&#34;,但它仍然无效:

              <binding name="BasicHttpBinding_IExt" closeTimeout="01:00:01"
    openTimeout="02:00:01" receiveTimeout="01:00:01" sendTimeout="09:00:00"
    maxBufferPoolSize="524288000" maxBufferSize="65536000" maxReceivedMessageSize="65536000">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:56296/ExtService.svc" binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_IExt" contract="ExtService.IExt"
            name="BasicHttpBinding_IExt" behaviorConfiguration="Behaviors.EndpointBehavior"  />
    </client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="Behaviors.EndpointBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
</system.serviceModel>

0 个答案:

没有答案