代码之家  ›  专栏  ›  技术社区  ›  Ali Haddani

413有效载荷比500系统大。服务模型。当我在WCF sharepoint应用程序中增加maxReceivedMessage时,ServiceActivationException

  •  0
  • Ali Haddani  · 技术社区  · 2 年前

    我在sharepoint 2016内部部署环境中开发了wcf Web服务。

    当我试图上传一个长身体的时候,我经常会收到一个413有效载荷太大的错误,所以我改变了我的应用程序。请对此进行配置:

        <?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>
    

    但现在我得到了这个错误:500(System.ServiceModel.ServiceActivationException)

    有没有办法解决这个问题?

    0 回复  |  直到 2 年前
        1
  •  0
  •   Lan Huang    2 年前

    我发现了 behaviorConfiguration , bindingConfiguration , <security mode="Transport"> 未在代码中设置,请确保对其进行配置。

    你可以试着设置 includeExceptionDetailInFaults true configuring tracing 获取错误详细信息。

    推荐文章