0

Getting the error only on Uploading a byte[] of nearly 250k but downloading of the same byte[] array are fin using the same config.

I've looked into Streaming but the single parameter doesnt work and these file sizes are huge. I have been able to upload a simple text file of 630 bytes and it works fine.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
          <binding name="BasicHttpBinding_IGenerateLetterWcf"
                   maxBufferSize="20000000" maxReceivedMessageSize="20000000"
                   closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" >
            <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </binding>
        </basicHttpBinding>
    </bindings>
    <client>         
        <endpoint address="http://localhost:61394/GenerateLetterWcf.svc" 
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGenerateLetterWcf" 
            contract="GenerateLetterWcfSvc.IGenerateLetterWcf" name="BasicHttpBinding_IGenerateLetterWcf" />          
    </client>
</system.serviceModel>
</configuration>
    <?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="DTPLibrary.Properties.Settings.XXXXConnectionString1" connectionString="data source=XXXXX;initial catalog=XXXXXX;User ID=SQLAdmin;Password=XXXXXX" providerName="System.Data.SqlClient"/>
  </connectionStrings>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.net>
    <settings>
      <servicePointManager expect100Continue="false"/>
    </settings>
  </system.net>
  <system.serviceModel>
    <diagnostics>
    <messageLogging
         logEntireMessage="true"
         logMalformedMessages="true"
         logMessagesAtServiceLevel="true"
         logMessagesAtTransportLevel="true"
         maxMessagesToLog="3000000"
         maxSizeOfMessageToLog="2000000"/>
  </diagnostics>

    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IEntitySearchWcf" maxBufferSize="10000000" maxReceivedMessageSize="10000000" closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" />
        <binding name="BasicHttpBinding_IBrokerWcf" maxBufferSize="6500000" maxReceivedMessageSize="6500000" />
        <binding name="BasicHttpBinding_IProjectWcf" maxBufferSize="9900000" maxReceivedMessageSize="9900000" />
        <binding name="BasicHttpBinding_ILoginWcf" maxReceivedMessageSize="20000000" maxBufferSize="20000000" /> 
        <binding name="BasicHttpBinding_ISupportWcf" maxBufferSize="9900000" maxReceivedMessageSize="9900000" />
        <binding name="BasicHttpBinding_IInscoWcf" maxBufferSize="100000000" maxReceivedMessageSize="100000000" />
        <binding name="BasicHttpBinding_IClientMaintenanceWcf" maxReceivedMessageSize="9900000" />
        <binding name="BasicHttpBinding_IWebUserWcf" maxReceivedMessageSize="9900000" />
        <binding name="BasicHttpBinding_IRoleWcf" maxReceivedMessageSize="9900000" />
        <binding name="BasicHttpBinding_ILabelWcf" maxReceivedMessageSize="10000000" maxBufferSize="10000000" />
        <binding name="BasicHttpBinding_IProjectTypeWcfSvc" maxReceivedMessageSize="9900000" />
        <binding name="BasicHttpBinding_IDropDownWcf" maxBufferSize="100000000" maxReceivedMessageSize="100000000" />
        <binding name="BasicHttpBinding_IDefaultCertLimitWcf" maxBufferSize="100000000" maxReceivedMessageSize="100000000" />
        <binding name="BasicHttpBinding_IConfigurationWcf" />
        <binding name="BasicHttpBinding_IEndorsementsWcf" />
        <binding name="BasicHttpBinding_IProjectCertReqWcf" maxBufferSize="2000000000" maxReceivedMessageSize="2000000000" />
        <binding name="BasicHttpBinding_IInsuredEntryWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
        <binding name="BasicHttpBinding_ICertWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
        <binding name="BasicHttpBinding_IDocumentWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
        <binding name="BasicHttpBinding_IReportsWcf" />
        <binding name="BasicHttpBinding_ICertGenLetterTemplWcf" />
        <binding name="BasicHttpBinding_IGenerateLetterWcf" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"  
                 closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" 
                 />
        <binding name="BasicHttpBinding_ILinkImagesWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
        <binding name="BasicHttpBinding_IErrorLogWcf" />
        <binding name="BasicHttpBinding_IDashBoardWcf" />
        <binding name="BasicHttpBinding_IReviewScannedCertificateWcf" maxBufferSize="1000000000" maxReceivedMessageSize="1000000000" />
        <binding name="BasicHttpBinding_IAllEndorsementsWcf" />
        <binding name="BasicHttpBinding_IScanDocumentWcf" />
        <binding name="BasicHttpBinding_IUserWcf" />
        <binding name="BasicHttpBinding_IOutputLogWcf" />
        <binding name="BasicHttpBinding_IStreamServiceWcf" closeTimeout="00:20:00"
            openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
            maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
            maxReceivedMessageSize="2147483647" transferMode="Streamed" messageEncoding="Mtom"/>        
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:61394/EntitySearchWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEntitySearchWcf" contract="EntitySearchWcfSvc.IEntitySearchWcf" name="BasicHttpBinding_IEntitySearchWcf" />
      <endpoint address="http://localhost:61394/BrokerWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBrokerWcf" contract="BrokerWcfSvc.IBrokerWcf" name="BasicHttpBinding_IBrokerWcf" />
      <endpoint address="http://localhost:61394/ProjectWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProjectWcf" contract="ProjectWcfSvc.IProjectWcf" name="BasicHttpBinding_IProjectWcf" />
      <endpoint address="http://localhost:61394/SupportWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISupportWcf" contract="SupportWcfSvc.ISupportWcf" name="BasicHttpBinding_ISupportWcf" />
      <endpoint address="http://localhost:61394/LoginWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILoginWcf" contract="LoginWcfSvc.ILoginWcf" name="BasicHttpBinding_ILoginWcf" />
      <endpoint address="http://localhost:61394/InscoWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IInscoWcf" contract="InscoWcfSvc.IInscoWcf" name="BasicHttpBinding_IInscoWcf" />
      <endpoint address="http://localhost:61394/ClientMaintenanceWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IClientMaintenanceWcf" contract="ClientMaintenanceWcfSvc.IClientMaintenanceWcf" name="BasicHttpBinding_IClientMaintenanceWcf" />
      <endpoint address="http://localhost:61394/WebUserWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWebUserWcf" contract="WebUserWcfSvc.IWebUserWcf" name="BasicHttpBinding_IWebUserWcf" />
      <endpoint address="http://localhost:61394/RoleWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRoleWcf" contract="RoleWcfSvc.IRoleWcf" name="BasicHttpBinding_IRoleWcf" />
      <endpoint address="http://localhost:61394/LabelWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILabelWcf" contract="LabelWcfSvc.ILabelWcf" name="BasicHttpBinding_ILabelWcf" />
      <endpoint address="http://localhost:61394/ProjectTypeWcfSvc.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProjectTypeWcfSvc" contract="ProjectTypeWcfSvc.IProjectTypeWcfSvc" name="BasicHttpBinding_IProjectTypeWcfSvc" />
      <endpoint address="http://localhost:61394/DefaultCertLimitWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDefaultCertLimitWcf" contract="DefaultCertLimitWcfSvc.IDefaultCertLimitWcf" name="BasicHttpBinding_IDefaultCertLimitWcf" />
      <endpoint address="http://localhost:61394/DropDownWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDropDownWcf" contract="DropDownWcfSvc.IDropDownWcf" name="BasicHttpBinding_IDropDownWcf" />
      <endpoint address="http://localhost:61394/ConfigurationWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IConfigurationWcf" contract="ConfigurationWcfSvc.IConfigurationWcf" name="BasicHttpBinding_IConfigurationWcf" />
      <endpoint address="http://localhost:61394/EndorsementsWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEndorsementsWcf" contract="EndorsementsWcfSvc.IEndorsementsWcf" name="BasicHttpBinding_IEndorsementsWcf" />
      <endpoint address="http://localhost:61394/ProjectCertReqWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProjectCertReqWcf" contract="ProjectCertReqWcfSvc.IProjectCertReqWcf" name="BasicHttpBinding_IProjectCertReqWcf" />
      <endpoint address="http://localhost:61394/InsuredEntryWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IInsuredEntryWcf" contract="InsuredEntryWcfSvc.IInsuredEntryWcf" name="BasicHttpBinding_IInsuredEntryWcf" />
      <endpoint address="http://localhost:61394/CertWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICertWcf" contract="CertWcfSvc.ICertWcf" name="BasicHttpBinding_ICertWcf" />
      <endpoint address="http://localhost:61394/DocumentWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDocumentWcf" contract="DocumentWcfSvc.IDocumentWcf" name="BasicHttpBinding_IDocumentWcf" />
      <endpoint address="http://localhost:61394/ReportsWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IReportsWcf" contract="ReportsWcfSvc.IReportsWcf" name="BasicHttpBinding_IReportsWcf" />
      <endpoint address="http://localhost:61394/CertGenLetterTemplWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICertGenLetterTemplWcf" contract="CertGenLetterTemplWcfSvc.ICertGenLetterTemplWcf" name="BasicHttpBinding_ICertGenLetterTemplWcf" />
      <endpoint address="http://localhost:61394/GenerateLetterWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGenerateLetterWcf" contract="GenerateLetterWcfSvc.IGenerateLetterWcf" name="BasicHttpBinding_IGenerateLetterWcf" />
      <endpoint address="http://localhost:61394/LinkImagesWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILinkImagesWcf" contract="LinkImagesWcfSvc.ILinkImagesWcf" name="BasicHttpBinding_ILinkImagesWcf" />
      <endpoint address="http://localhost:61394/ErrorLogWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IErrorLogWcf" contract="ErrorLogWcfSvc.IErrorLogWcf" name="BasicHttpBinding_IErrorLogWcf" />
      <endpoint address="http://localhost:61394/DashBoardWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDashBoardWcf" contract="DashboardWcfSvc.IDashBoardWcf" name="BasicHttpBinding_IDashBoardWcf" />
      <endpoint address="http://localhost:61394/ReviewScannedCertificateWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IReviewScannedCertificateWcf" contract="ReviewScannedCertificateWcfSvc.IReviewScannedCertificateWcf" name="BasicHttpBinding_IReviewScannedCertificateWcf" />
      <endpoint address="http://localhost:61394/AllEndorsementsWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAllEndorsementsWcf" contract="AllEndorsementsWcfSvc.IAllEndorsementsWcf" name="BasicHttpBinding_IAllEndorsementsWcf" />
      <endpoint address="http://localhost:61394/ScanDocumentWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IScanDocumentWcf" contract="ScanDocumentWcfSvc.IScanDocumentWcf" name="BasicHttpBinding_IScanDocumentWcf" />
      <endpoint address="http://localhost:61394/UserWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserWcf" contract="UserWcfSvc.IUserWcf" name="BasicHttpBinding_IUserWcf" />
      <endpoint address="http://localhost:61394/OutputLogWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IOutputLogWcf" contract="OutputLogWcfSvc.IOutputLogWcf" name="BasicHttpBinding_IOutputLogWcf" />
      <endpoint address="http://localhost:61394/StreamServiceWcf.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IStreamServiceWcf" contract="StreamServiceWcfSvc.IStreamServiceWcf" name="BasicHttpBinding_IStreamServiceWcf" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="1365536" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"  />
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="" helpEnabled="true"   maxReceivedMessageSize="65536000"/>
      </webHttpEndpoint>
    </standardEndpoints>  
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>

  </system.webServer>


  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="System.ServiceModel.MessageLogging">
        <listeners>
          <add name="messages"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData="c:\logs\messages.svclog" />
        </listeners>
      </source>
      <source name="System.ServiceModel"
              switchValue="Warning, Critical, Error, Verbose"
              propagateActivity="true">
        <listeners>
          <add name="sdt"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\logs\service.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

</configuration>
Chuck
  • 41
  • 1
  • 5
  • Have you checked `maxReceivedMessageSize` in your service config binding? – wp78de Oct 07 '19 at 17:21
  • It's a Web Service setup Asynch, not a REST. – Chuck Oct 07 '19 at 17:54
  • 1
    Possible duplicate of [(413) Request Entity Too Large | uploadReadAheadSize](https://stackoverflow.com/questions/10122957/413-request-entity-too-large-uploadreadaheadsize) – wp78de Oct 07 '19 at 18:23
  • I've tried the upload setting as well as the messageType="Mtom", when I use this I get a "The remote server returned an error: (415) Cannot process the message because the content type 'multipart/related; type="application/xop+xml";start="";boundary="uuid:cffe9f62-304e-4cbb-ab0a-a983476074df+id=1";start-info="text/xml"' was not the expected type 'text/xml; charset=utf-8'" message. – Chuck Oct 07 '19 at 18:50

1 Answers1

0

I have a question about your present configuration. Why you use the absolute service address in your endpoint address? if the service is hosted in IIS, the base address is provided by the IIS site binding module.
enter image description here
Thereby I suspect the current live connection doesn’t use this endpoint address, which results in the failure of the MaxReceivedMessageSize setting. I would like to know what the service address the client actually used is. Only apply the configuration on the correct service endpoint address can take effect.
Updated.
It seems that the above configuration is on the client-side, and the below configuration is on the server-side. Also, the WCF service contains multiple service contracts.
The configuration on the server-side doesn’t explicitly declare how does the service is created. There are neither Services section nor ProtocolMapping section in the configuration file. like the below form.

    <services>
      <service name="ConsoleApp3.TestService">
        <endpoint address="" binding="basicHttpBinding" contract="ConsoleApp3.ITestService" ></endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
      </service>
</services>

And,

<protocolMapping>
      <add binding="webHttpBinding" scheme="http"/>
</protocolMapping>

Namely, it uses the default Basichttpbinding to create the service. there is no way to apply the setting to the right service endpoint.
I suggest you attempt the below configuration on the server-side.

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="mybinding" maxBufferSize="20000000" maxReceivedMessageSize="2147483647" >
          <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <protocolMapping>
      <add binding="basicHttpBinding" scheme="http" bindingConfiguration="mybinding"/>
    </protocolMapping>
  </system.serviceModel>

It can also support multiple service contracts.
Feel free to let me know if the problem still exists.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22
  • So it's still in development and I have not yet deployed on a IIS yet. This is happening on a IIS Express in dev. – Chuck Oct 08 '19 at 12:04
  • Before the client consumed the WCF service, can you access the WSDL document properly with your specific URL? Even though it is hosted in the IISExpress, it should not be the absolute address, please verify whether the service is available. Finally, you could post your complete configuration and I will attempt to correct it. – Abraham Qian Oct 09 '19 at 01:49
  • Yes, the service advertises correctly without issue. – Chuck Oct 09 '19 at 11:57
  • Your configuration seems OK, very nice. Please post your complete System.servicemodel section in the configuration file. I will try to reproduce your issue and give an effective reply. ^.^ – Abraham Qian Oct 10 '19 at 05:57
  • I tried about a thousand times to post the Web.confg but this forum is frustrating posting code and wasnt able. – Chuck Oct 10 '19 at 12:01
  • ok, I figured how to post both the Client.Config & Web.Config. – Chuck Oct 10 '19 at 12:47
  • I added the above suggested server-side config and got the following new error. FOr IIS Express, not sure that is refered in the "server's diagnostic trace logs". The requested service, 'http://localhost:61394/GenerateLetterWcf.svc' could not be activated. See the server's diagnostic trace logs for more information. – Chuck Oct 11 '19 at 11:33
  • 1
    Looks like a missed wiring up a binding name and now able to get it to work, I'll have to pour over this information as I'm not entirely sure what actually fixed it. but thank you very much for your help. – Chuck Oct 12 '19 at 13:39