1

My system:

IIS 7.5

Visual Studio 2010

Framework 4

I have make a Web Service that receive a file(byte array). I have make a console app that consume it(Add Service Reference-->Advance-->Add Web Reference). With http it is working perfectly. But I need to consume it with https. So, when I try to consume it with https, it is giving me HTTP 413: Request Entity Too Large. I have been reading a lot, but it is impossible. I have tried to put in the webconfig of the Web Service:

    <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_INopService" maxReceivedMessageSize="22147483647" maxBufferPoolSize="252428800" maxBufferSize="22147483647">
          <readerQuotas maxDepth="256" maxStringContentLength="22147483647" maxArrayLength="2222216384"
            maxBytesPerRead="2222220000" maxNameTableCharCount="2222216384" ></readerQuotas>
        </binding>
      </basicHttpBinding>

<basicHttpBinding>
        <binding name="HttpBigMessage"
             receiveTimeout="00:10:00"
             sendTimeout="00:10:00"
             maxReceivedMessageSize="2147483647" >
          <security mode="None" />
        </binding>
      </basicHttpBinding>

  </bindings>

    <client>
      <endpoint address="https://localhost/hmenu/GetData.asmx"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INopService"
        contract="PhotoSavingsService.INopService" name="BasicHttpBinding_INopService" />
    </client>


  </system.serviceModel>

The file is not too large. Where do I need to put the max size?

Thank

Za7pi
  • 1,048
  • 4
  • 18
  • 31

1 Answers1

0

Many times by adding line

<httpRuntime maxRequestLength="214748364" executionTimeout="9999" 
targetFramework="4.5"/>

gives 500 error

Please find out Which is allready exists in your web configuration file Hi guys Generally 500 error occurs if there any wrong configuration in the web.config fix that first. Here I am providing 413 entity is too large on https protocol issue fix

web.config before issue fixed

<bindings>
  <webHttpBinding>
    <binding name="RestServiceBindingConfig">
      <security mode="Transport"></security>
    </binding>
    <binding name="HttpRestServiceBindingConfig">
      <security mode="None"></security>
    </binding>
<binding maxBufferPoolSize="76000000" maxReceivedMessageSize="19000000">
      <readerQuotas maxDepth="32" maxStringContentLength="19000000" 
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
    </binding>
  </webHttpBinding>
</bindings>
<behaviors>

we just copy pasted readerquotas maxBufferPoolSize maxReceivedMessageSize in the Transport mode RestServiceBindingConfig this made the trick first RestServiceBindingConfig is for https second HttpRestServiceBindingConfig binding for http

web.config after issue fixed

<bindings>
  <webHttpBinding>
    <binding name="RestServiceBindingConfig" maxBufferPoolSize="2147483647" 
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
           maxArrayLength="2147483647" maxBytesPerRead="4096" 
           maxNameTableCharCount="16384" />
      <security mode="Transport"></security>
    </binding>
    <binding name="HttpRestServiceBindingConfig" 
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
           maxArrayLength="2147483647" maxBytesPerRead="4096" 
           maxNameTableCharCount="16384" />
      <security mode="None"></security>
    </binding>

  </webHttpBinding>
</bindings>
<behaviors>
A.Rashad
  • 984
  • 9
  • 25
  • 1
    Kindly edit your answer, you can see that code is mixed with your explanation, it would be perfect if you separated code from explanation – A.Rashad Aug 25 '17 at 21:09