Ali Haddani
Ali Haddani

Reputation: 21

Getting 413 Payload too large then 500 System.ServiceModel.ServiceActivationException when i increase maxReceivedMessage in my WCF sharepoint app

I developed a wcf webservice in a sharepoint 2016 on premise environment.

When I try to upload a long body I used to get a 413 payload too large error so I changed my app.config to this:

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service name="ilem.Sharepoint.WebServices.ISAPI.ilemGroupWS.Service">
                <endpoint address="" binding="basicHttpBinding" contract="ilem.Sharepoint.WebServices.ISAPI.ilemGroupmWS.IService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8733/Design_Time_Addresses/ilem.Sharepoint.WebServices.ISAPI.ilemGroup/Service/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
      <standardEndpoints>
        <webHttpEndpoint>
          <standardEndpoint name=""
               helpEnabled="true"
               automaticFormatSelectionEnabled="true"
               maxReceivedMessageSize="2147000000"
                 />
        </webHttpEndpoint>
      </standardEndpoints>
      <bindings>
        <basicHttpBinding>
          <binding name="MyBinding" maxBufferPoolSize="2000000000"
      maxBufferSize="2000000000" maxReceivedMessageSize="2000000000">
            <readerQuotas maxDepth="32"
                             maxArrayLength="200000000"
                             maxStringContentLength="200000000"/>
          </binding>
        </basicHttpBinding>
        <basicHttpsBinding>
          <binding name="MyBinding" maxBufferPoolSize="2000000000"
      maxBufferSize="2000000000" maxReceivedMessageSize="2000000000">
            <readerQuotas maxDepth="32"
                             maxArrayLength="200000000"
                             maxStringContentLength="200000000"/>
          </binding>
        </basicHttpsBinding>
      </bindings>
    </system.serviceModel>
</configuration>

But now I get this error: 500 (System.ServiceModel.ServiceActivationException)

Is there any way to resolve this issue?

Upvotes: 0

Views: 195

Answers (1)

Lan Huang
Lan Huang

Reputation: 821

I found that behaviorConfiguration, bindingConfiguration, <security mode="Transport"> are not set in your code, please make sure to configure them.

You can try setting includeExceptionDetailInFaults to true or configuring tracing to get error details.

Upvotes: 0

Related Questions