locked
Setting maxReceivedMessageSize in web.conf WCF no longer working - RRS feed

  • Question

  • User-1332434629 posted

    The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.


    Service side configuration
     changes are as follows:-

    Applications\Service_Site\bin\Web.conf

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

    <client>
    <endpoint binding="basicHttpBinding" bindingConfiguration="lkmsMigrationServiceSOAP" contract="Common.Core.Generated.MigrationAPI.EnterpriseMigrationServiceOperations" name="lkmsBulkImportServiceSOAP" behaviorConfiguration="clientEndpointCredential"/>
    </client>

    Client side configuration are as follows:-

    Applications\Client_Site\bin\Web.conf

    <bindings>
    <basicHttpBinding>
    <binding name="SecurityTokenServiceSOAPBinding" maxBufferSize="1073741824" maxBufferPoolSize="524288" maxReceivedMessageSize="1073741824" >
    <readerQuotas maxArrayLength="16384" maxBytesPerRead="1073741824" maxDepth="32" maxNameTableCharCount="1073741824" maxStringContentLength="1073741824"/>
    <security mode="None">
    <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
    <message clientCredentialType="UserName" algorithmSuite="Default"/>
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>

    <client>
    <endpoint address="http://org-2k8-16-38.domain.com:9100/MigrationService.svc" binding="basicHttpBinding" bindingConfiguration="SecurityTokenServiceSOAPBinding" contract="Common.Core.Generated.MigrationAPI.EnterpriseMigrationServiceOperations" name="lkmsMigrationServiceSOAP"/>
    </client>

    Monday, March 31, 2014 6:03 AM

All replies

  • User-417640953 posted

    <client>
    <endpoint binding="basicHttpBinding" bindingConfiguration="lkmsMigrationServiceSOAP" contract="Common.Core.Generated.MigrationAPI.EnterpriseMigrationServiceOperations" name="lkmsBulkImportServiceSOAP" behaviorConfiguration="clientEndpointCredential"/>
    </client>

    Hi,

    Thanks for the post.

    Above configuration is set for client endpoint. It should be like below.

     
     <services>
          <service name="YourServiceName"  >
            <endpoint address="" binding="basicHttpBinding" contract="Common.Core.Generated.MigrationAPI.EnterpriseMigrationServiceOperations" bindingConfiguration="lkmsMigrationServiceSOAP"></endpoint>
          </service>
     </services>

    In the sever side, please make sure your Binding configuration applied to service endpoint.

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/872fff1e-b78e-4b49-808c-558f46a11a17/the-maximum-message-size-quota-for-incoming-messages-65536-has-been-exceeded-to-increase-the?forum=wcf

    Thanks.

    Best Regards!

    Monday, March 31, 2014 10:21 PM
  • User-1332434629 posted

    Here the motto is to upload 70 MB file through WCF basicHttpBinding, and wanted to check whether this is possible or not.

    Sharing updated config, still the solution is not working, upload request taking lot of time and then in turn getting  :-

    System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

    And I was also getting sendTimeout error earlier to above exception

    Added service and here is the change:-

    Client web.conf configuration:-
    <bindings>
    <basicHttpBinding>
    <binding name="basicHttpsBindingConfig" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="1073741824" maxBufferPoolSize="524288" maxReceivedMessageSize="1073741824" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
    <readerQuotas maxDepth="32" maxStringContentLength="1073741824" maxArrayLength="1073741824" maxBytesPerRead="1073741824" maxNameTableCharCount="1073741824"/>
    <security mode="Transport">
    <transport clientCredentialType="None"></transport>
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>
    <client>
    <!-- CUSTOMIZABLE - UPDATE THE "address" TO POINT TO THE PKI Enterprise Gateway CERTIFICATE MIGRATION SERVICE -->
    <endpoint address="https://hostname:9100/MigrationService.svc" binding="basicHttpBinding" bindingConfiguration="basicHttpsBindingConfig" contract="Common.Core.Generated.MigrationAPI.EnterpriseMigrationServiceOperations" name="lkmsMigrationServiceSOAP"/>
    </client>

    Service web.conf configuration:-

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


    <services>
    <service behaviorConfiguration="httpsBehavior" name="PKIServices.Core.ServiceListener.MigrationService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpsBindingConfig" contract="Common.Core.Generated.MigrationAPI.EnterpriseMigrationServiceOperations"> </endpoint>
    </service>
    </services>
    <!-- DO NOT UPDATE THIS SECTION (client) -->
    <client>
    <endpoint binding="basicHttpBinding" bindingConfiguration="lkmsMigrationServiceSOAP" contract="Common.Core.Generated.MigrationAPI.EnterpriseMigrationServiceOperations" name="lkmsBulkImportServiceSOAP" behaviorConfiguration="clientEndpointCredential"/>
    </client>

    Tuesday, April 1, 2014 9:51 AM
  • User-1332434629 posted

    Same works well with 19KB file upload.

    But  with 980KB file upload getting following exception:-

    System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to https://hostname:9100/MigrationService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    --- End of inner exception stack trace ---
    at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
    at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
    at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
    at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
    at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
    at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
    --- End of inner exception stack trace ---
    at System.Net.HttpWebRequest.GetResponse()
    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    --- End of inner exception stack trace ---

    Server stack trace:
    at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
    at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

    Tuesday, April 1, 2014 10:28 AM
  • User-417640953 posted

    Hi,

    We will discuss the issue in below thread you post.

    http://forums.asp.net/p/1977999/5665056.aspx?p=True&t=635319911583425662&pagenum=1

    Thanks.

    Tuesday, April 1, 2014 11:20 PM