The remote server returned an unexpected response: (413) Request Entity Too Large.

前端 未结 6 1940
孤街浪徒
孤街浪徒 2020-11-30 04:14

I\'m trying to build a WCF Application service, using FW4.0. My service work correctly when transferring EntiryFramework object between Server and client. But I\'m having pr

相关标签:
6条回答
  • 2020-11-30 04:20

    For the record

    I think I got it. The Web.Config from the service does not have the binding information. I placed this info in it, and voila!

    <bindings>
          <basicHttpBinding>
            <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
              <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            </binding>
          </basicHttpBinding>
    </bindings>
    

    Note here that the binding did not have a name specified.

    0 讨论(0)
  • 2020-11-30 04:27

    If you create custom binding e.g. MybasicBinding,

      <basicHttpBinding>
          <binding name="MybasicBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
                   maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" >
                <readerQuotas maxDepth="32" maxBytesPerRead="200000000" 
                 maxArrayLength="200000000" maxStringContentLength="200000000" />
          </binding>
      </basicHttpBinding>
    

    To avoid the 413 error, Do not foreget to Specify the bindingConfiguration="MybasicBinding" for service endpointas,

    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MybasicBinding" contract="WCFService.IService" />
    
    0 讨论(0)
  • 2020-11-30 04:29

    You don't have an explicit endpoint (meaning one defined in your config file) for your service, so the binding configuration you declared ("BasicHttpBinding_IService") isn't being used. WCF is providing a default endpoint along with a default binding (basicHttpBinding unless you overrode it in the protocolMapping section of the config file).

    You have two ways to resolve this in your service's config file:

    You can make the "BasicHttpBinding_IService" configuration the default by removing the name attribute:

    <binding maxBufferPoolSize="2147483647".....
    

    Or you define an endpoint explicitly in the config and assign your binding configuration to the bindingConfiguration attribute of the endpoint.

    <services>
        <endpoint address="" 
                  binding="basicHttpBinding"
                  bindingConfiguration="BasicHttpBinding_IService"     
                  contract="ServiceReference1.IService"  />
    </services>
    
    0 讨论(0)
  • 2020-11-30 04:29

    I was getting this error. I discovered that I had created the binding configuration, but failed to set the endpoint to that configuration. Therefore, the endpoint was using an unnamed binding configuration with the default settings. So, maxReceivedMessageSize was 65k.

    0 讨论(0)
  • 2020-11-30 04:32

    if no binding is specified and httpsgetenabled is true then you may need to set basichttpsbinding in your service application's web.config

    <bindings>
      <basicHttpsBinding>
        <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
          <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpsBinding>
    

    0 讨论(0)
  • 2020-11-30 04:35

    Another way to fix this and have a better look at web.config file, is to edit the web.config file with the "Microsoft Service Configuration Editor" (C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\SvcConfigEditor.exe)

    0 讨论(0)
提交回复
热议问题