Custom WCF Service and MaxReceivedMessageSize RRS feed

  • Question

  • I deployed a custom WCF REST service (a file uploader) into ISAPI folder. I am able to call this service successfully using jQuery client. I followed this article to develop WCF service:

    Issue is that WCF service is unable to accept any files over 64KB.

    I understand that I need to increase MaxReceivedMessageSize property for this service. However, I am confused as to in which web.config I need to make this change. I see a web.config in ISAPI folder or do I need to create a new web.config? If I scroll through ISAPI web.config, I do not see any endpoint for the WCF service.

    Here is the svc file:

    <%@ ServiceHost Language="C#" Debug="true"
        Service="FileUpload.ISAPI.UploadService, $SharePoint.Project.AssemblyFullName$"
        Microsoft.SharePoint.Client.ServerRuntime, Version=, Culture=neutral,
        PublicKeyToken=71e9bce111e9429c" %>

    Any pointers?

    • Edited by diffident Friday, May 24, 2019 8:17 PM
    Friday, May 24, 2019 8:15 PM


  • Thanks, Lee. I ended up doing a combination of several changes.

    1. Modified factory attribute of SVC file from MultipleBaseAddressWebServiceHostFactory to System.ServiceModel.Activation.WebServiceHostFactory and moved WCF service to a new folder under ISAPI and created a dedicated web.config.

    2. Modified maxReceivedMessageSize in the binding element and added readerQuotas element with maxBytesPerRead in the server-side web.config. Also added httpRunTime element with maxRequestLength property.

    3. Modified client web.config to include maxReceivedMessageSize. No readerQuotas was required.

    Hope this helps someone!

    • Marked as answer by diffident Tuesday, May 28, 2019 8:49 PM
    Tuesday, May 28, 2019 8:49 PM

All replies