Search code examples
wcffile-uploaddynamics-crm-2011dynamics-crmdynamics-crm-2015

Unable to upload the file of size 27 MB to MS CRM from Web Portal


We are trying to upload the file of size 27 MB to CRM 2015 from web portal. But we are getting the below error message. But the same file can be uploaded from CRM. Also we are able to upload the file of size 15 MB from portal.

"There was no endpoint listening at http://MyServer/MyOrg/XRMServices/2011/Organization.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

After enabling the CRM trace, below is the error message I captured.

"[2017-01-05 18:56:15.309] Process:Microsoft.Crm.Sandbox.WorkerProcess |Organization:00000000-0000-0000-0000-000000000000 |Thread: 1 |Category: Sandbox |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 00000000-0000-0000-0000-000000000000 | SandboxWorkerMain.Main ilOffset = 0x23E
>Changed MinIOThreads for worker from 1 to 101and MinWorkerThreads from 1 to 101"

Appreciate if you have any solution for this issue.

[Edited] Below is the piece of code to create a note with attachment from portal.

    public IOrganizationService ServiceProxy { get { return _ServiceProxy; } }

    public void Create(Entity newEntity, Guid? impersonateUserId = null, bool detectDuplicates = true)
    {
        setServiceCredentials(impersonateUserId);
        Guid newId = ServiceProxy.Create(newEntity);
        newEntity.Id = newId;            
    }

    public Guid CreateNote(Guid objectId, string fileName, byte[] documentData, string mimeType = "application\\ms-word"
        , string subject = "", string notetext = "", LookupValue ownerId = null )
    {
        string encodedData = System.Convert.ToBase64String(documentData);
        Entity annotation = new Entity("annotation");
        annotation["objectid"] = new EntityReference(GetEntityName(), objectId);
        annotation["subject"] = subject;
        annotation["notetext"] = notetext;
        annotation["documentbody"] = encodedData;
        annotation["filename"] = fileName;
        annotation["mimetype"] = mimeType;
        if(ownerId != null)
            annotation["ownerid"] = new EntityReference(ownerId.LogicalName, ownerId.Id);
        Context.Create(annotation);
        return annotation.Id;
    }

Solution

  • This issue has been fixed by using the below solution. Also you can refer this link.

    My solution was 26MB, I saw with feedler that the content sent was close to 46MB (because it is envolved in SOAP request, Base64, etc).

    I changed CRM webconfig in httpRuntime the attribute maxRequestLength to be 100000000 (100MB because my solution is still growing) and also maxAllowedContentLength in request filtering in IIS at CRM's website