标签: maxreceivedmessagesize

传入邮件的最大邮件大小限额(65536)....要增加配额,请使用MaxReceivedMessageSize属性

我遇到了这个我正在努力处理的疯狂问题.我知道当我们获取大量数据时,我们必须增加客户端.config文件的配额,但如果我的客户端向WCF服务器发送大量数据,我应该怎么做?

当我发送小尺寸输入参数时,它完全正常.不幸的是,当输入变大时,它会崩溃.

调试器说:

错误请求,400;

在跟踪文件上它是:

已超出传入邮件的最大邮件大小限额(65536).要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.

是否有某种方法可以增加服务器端的数据配额?如果是这样,怎么样?

这是我的示例配置相关部分:

<bindings>
  <basicHttpBinding>
    <binding name="MyBasicHttpBinding"
        closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
        sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false"
        hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
        maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
          maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>

  </basicHttpBinding>
</bindings>

 <services>
  <service name="MyWcfService">
    <endpoint address="http://myservice..."
      binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding"
      name="MyBasicHttpBinding" contract="IMyContract" />
  </service>
</services> 
Run Code Online (Sandbox Code Playgroud)

这是我的客户端代码(我动态创建):

        var binding = new BasicHttpBinding();
        binding.MaxBufferPoolSize = 2147483647;
        binding.MaxBufferSize = 2147483647;
        binding.MaxReceivedMessageSize = 2147483647;
        binding.ReaderQuotas.MaxStringContentLength = 2147483647;
        binding.ReaderQuotas.MaxArrayLength = …
Run Code Online (Sandbox Code Playgroud)

wcf server-side request maxreceivedmessagesize

20
推荐指数
3
解决办法
9万
查看次数

WCF Streaming和maxReceivedMessageSize

为什么在实现WCF流式传输时maxReceivedMessageSize属性相关?由于缓冲和持久性由流的消费者处理,为什么WCF关注单个服务操作可能需要多长时间?

我正在开发一个项目,可以处理从服务器到客户端的大型文件.我认为WCF流是一个很好的选择,因为它应该允许处理理论上无限的文件大小.我的客户端和服务器都将transportMode(在绑定上)设置为"Streamed",并将消息设计为包含Streams.但是,这还不够,因为我收到一个CommunicationException,表明我需要增加maxReceivedMessageSize属性.遵循异常的建议,神奇地增加属性可以使一切工作完美.

我担心WCF迫使我"限制"我的服务/客户端可以处理多少,即使流媒体应该是"无限的".如果出现的文件恰好大于我的绑定配置,则会发生相同的CommunicationException.我不明白为什么WCF会随意限制我处理大文件的能力,"何时"和"如何"发送和存储这些文件现在是"我的"业务,因为我有一个流消费但我希望.

我错过了什么吗?

streaming wcf buffering maxreceivedmessagesize

10
推荐指数
1
解决办法
1812
查看次数

已超出传入邮件的最大邮件大小限额(65536)

我的WCF服务有一个OperationContract,它接受一个对象数组作为参数.这可能非常大.在寻找Bad Request:400的修复程序后,我找到了真正的原因:最大邮件大小.

我知道之前在很多地方已经提出过这个问题.我已经尝试过每个人都说:"增加客户端和服务器配置文件的大小." 我有.它仍然无法正常工作.

我的服务的web.config:

<system.serviceModel>
    <services>
      <service name="myService">
        <endpoint name="myEndpoint" address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="myBinding"
                  contract="Meisel.WCF.PDFDocs.IPDFDocsService" />
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="myBinding"
                 closeTimeout="00:11:00"
                 openTimeout="00:11:00"
                 receiveTimeout="00:15:00"
                 sendTimeout="00:15:00"
                 maxBufferSize="2147483647"
                 maxReceivedMessageSize="2147483647"
                 maxBufferPoolSize="2147483647"
                 transferMode="Buffered"
                 allowCookies="false"
                 bypassProxyOnLocal="false"
                 hostNameComparisonMode="StrongWildcard"
                 messageEncoding="Text"
                 textEncoding="utf-8"
                 useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483647"
                        maxStringContentLength="2147483647"
                        maxArrayLength="2147483647"
                        maxBytesPerRead="2147483647"
                        maxNameTableCharCount="2147483647" />
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

我的客户端的app.config:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IPDFDocsService"
                 closeTimeout="00:11:00"
                 openTimeout="00:11:00"
                 receiveTimeout="00:10:00"
                 sendTimeout="00:11:00"
                 allowCookies="false"
                 bypassProxyOnLocal="false" …
Run Code Online (Sandbox Code Playgroud)

c# wcf maxreceivedmessagesize

7
推荐指数
1
解决办法
2万
查看次数

如何覆盖WebServiceHostFactory MaxReceivedMessageSize?

那里有很多类似的问题,但我已经尝试过每一个解决方案都无济于事.

我们有一个使用WebServiceHostFactory初始化的Web服务,但是如果它被抛出超过64k,我们会收到'400 Bad Request'.通常情况下,这可以通过提升MaxReceivedMessageSize,MaxBufferSize和MaxBufferPoolSize来解决.问题是使用WebServiceHostFactory,Web.Config被完全忽略.我在ServiceModel部分中所做的任何更改都不会反映在服务中.

完全抛弃WebServiceHostFactory并从头开始设置web.config会很不错,但如果没有它,我们的服务将无法运行.其中一个方法有一个stream参数以及一些其他字符串参数.没有工厂,我们得到

System.InvalidOperationException: For request in operation Test to be a stream the operation must have a single parameter whose type is Stream
Run Code Online (Sandbox Code Playgroud)

所以不能选择拆除工厂.我无法确切地知道工厂正在做什么修复了这个错误,但我花了4天时间就没有了.

我也试过以编程方式覆盖MaxReceivedMessageSize,我在附近发现了一些例子:

protected override void OnOpening()
        {
            base.OnOpening();
            foreach (var endpoint in Description.Endpoints)
            {

                //var binding = endpoint.Binding as WebHttpBinding;
                //if (binding != null)
                //{
                //    binding.MaxReceivedMessageSize = 20000000;
                //    binding.MaxBufferSize = 20000000;
                //    binding.MaxBufferPoolSize = 20000000;
                //    binding.ReaderQuotas.MaxArrayLength = 200000000;
                //    binding.ReaderQuotas.MaxStringContentLength = 200000000;
                //    binding.ReaderQuotas.MaxDepth = 32;
                //}


                //var transport = endpoint.Binding.CreateBindingElements().Find<HttpTransportBindingElement>(); …
Run Code Online (Sandbox Code Playgroud)

rest wcf wcf-binding maxreceivedmessagesize webservicehost

7
推荐指数
2
解决办法
8565
查看次数

读取MTOM数据时已超出最大缓冲区大小

我必须使用外部Web服务,但是我收到以下错误:

读取MTOM数据时已超出最大缓冲区大小(65536)

在今天之前,我使用以下配置使用相同的服务:

    <bindings>
        <basicHttpBinding>
            <binding name="BOServiceSoap11Binding">
                <security mode="Transport" />
            </binding>
            <binding name="BOServiceSoap11Binding1" />
        </basicHttpBinding>
        <customBinding>
            <binding name="BOServiceSoap12Binding">
                <mtomMessageEncoding messageVersion="Soap12" />
                <httpsTransport />

            </binding>
        </customBinding>
    </bindings>
Run Code Online (Sandbox Code Playgroud)

这是我的终点:

<endpoint address="https://x.com/live-api/services/BOService.BOServiceHttpsSoap12Endpoint/"
            binding="customBinding" bindingConfiguration="BOServiceSoap12Binding"
            contract="xServiceReference.BOServicePortType" name="BOServiceHttpsSoap12Endpoint" />
Run Code Online (Sandbox Code Playgroud)

我尝试通过向customBinding标记及其子标记添加以下标记来增加MaxReceivedMessageSize:

MaxReceivedMessageSize="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647" maxBufferSize="2147483647"
Run Code Online (Sandbox Code Playgroud)

如何配置我的端点以获得正确的响应?

谢谢,

.net wcf soap mtom maxreceivedmessagesize

4
推荐指数
1
解决办法
3316
查看次数

在C#中设置web.config后仍然得到(413)"Request Entity Too Large"

我正在使用带C#的MVC4开发一个Web应用程序.

我需要通过AJAX发送PDF,所以我将它们转换为base64并将它们发送到C#中的函数.该函数将调用Web服务上的另一个函数.

问题是,Web服务函数没有得到base64字符串,因为它非常大,但不是TOO大,它大约111,000个字符,如70kb.我收到错误413

pdfCony是我的base64字符串

在此输入图像描述

我已经在web服务的web.config中设置了maxRecievedMesage:

 <bindings>
  <basicHttpBinding>
    <binding name="basicHttpsBinding" maxReceivedMessageSize="524288000" />
    <binding name="mexHttpBinding" maxReceivedMessageSize="524288000" />
  </basicHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="ServicioCCMasAvalBehavior" name="ServicioCCMasAval.ServicioCCMasAval">
    <endpoint address="/" binding="basicHttpBinding" contract="ServicioCCMasAval.IServicioCCMasAval" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
Run Code Online (Sandbox Code Playgroud)

所以我不知道是什么问题.请帮忙.

c# web-services maxreceivedmessagesize asp.net-mvc-4

3
推荐指数
1
解决办法
1万
查看次数

WCF MaxReceivedMessageSize错误

我在调用wcf服务时遇到错误(wshttpbinding).我已经将MaxReceivedMessageSize设置为最大值(2147483647).谁能告诉我什么是错的?

我正在使用"安全模式="消息"",这是一个问题吗?

错误: 已超出传入邮件的最大邮件大小限额(65536).要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性

配置:(客户端)

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="wsDemo" closeTimeout="00:15:00" openTimeout="00:15:00"
          receiveTimeout="00:15:00" sendTimeout="00:15:00" bypassProxyOnLocal="false"
          transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="00:15:00"
            enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
              algorithmSuite="Default" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://demo.com/DemoServices/DemoProduct.svc"
        binding="wsHttpBinding" bindingConfiguration="wsDemo" contract="DemoService.IProducts"
        name="wsDemo">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

服务器配置:

  <system.serviceModel>
    <services>
      <service behaviorConfiguration="LargeWS" name="GexaEnrollCustomer.GexaEnroll">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="SecureBinding"
          name="wsDemo" contract="MyInterfaces.IProducts">
          <identity>
            <dns …
Run Code Online (Sandbox Code Playgroud)

wcf maxreceivedmessagesize

2
推荐指数
1
解决办法
3万
查看次数