OfficeDev / ews-managed-api

Other
584 stars 317 forks source link

FileAttachment.Load() returns "Internal Server Error" #107

Closed donfmorrison closed 7 years ago

donfmorrison commented 7 years ago

I have a windows service that monitors an Office 365 email inbox for new mail and downloads any attachments. Service has been running successfully since Oct 2016.

Starting Friday (Feb 17, 2017) afternoon I have been receiving an "Internal Server Error" when using EWS Managed API to download an attachment. All other interactions with the server via EWS API seem ok.

The issue seems to be when I call the FileAttachment.Load() method to actually download the contents of the attachment. The server returns "HTTP/1.1 500 Internal Server Error".

I have turned tracing on within EWS API and here is the full request/response from Office 365 upon calling FileAttachment.Load() method:

<Trace Tag="EwsRequestHttpHeaders" Tid="10" Time="2017-02-20 15:51:14Z">
POST /EWS/Exchange.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Accept: text/xml
User-Agent: ExchangeServicesClient/15.00.0847.030
Accept-Encoding: gzip,deflate

</Trace>
<Trace Tag="EwsRequest" Tid="10" Time="2017-02-20 15:51:14Z" Version="15.00.0847.030">
  <?xml version="1.0" encoding="utf-8"?>
  <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
      <t:RequestServerVersion Version="Exchange2013_SP1" />
    </soap:Header>
    <soap:Body>
      <m:GetAttachment>
        <m:AttachmentIds>
          <t:AttachmentId Id="AAMkADBhZDI1YTM2LTY5MjMtNDJlMi1iZTJjLTNlMGU1OTIyMGZlNwBGAAAAAADf0dK6oM0vQKHH3XpoIDYvBwDChYzk0b/aQZmUSDWwklImAAAAAAEMAABOwtA8F96CTpAbhXR6AR97AABnH6LRAAABEgAQAAQBvdNdsNtNsr9mv/CDuS8=" />
        </m:AttachmentIds>
      </m:GetAttachment>
    </soap:Body>
  </soap:Envelope>
</Trace>
<Trace Tag="EwsResponseHttpHeaders" Tid="10" Time="2017-02-20 15:51:16Z">
HTTP/1.1 500 Internal Server Error
Transfer-Encoding: chunked
request-id: 0e0d47ac-8202-412f-a878-a34e2bcd225c
X-CalculatedBETarget: MWHPR02MB2877.namprd02.prod.outlook.com
X-BackEndHttpStatus: 500
X-DiagInfo: MWHPR02MB2877
X-BEServer: MWHPR02MB2877
X-FEServer: SN1PR12CA0005
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Date: Mon, 20 Feb 2017 15:51:16 GMT
Set-Cookie: exchangecookie=xxx; path=/
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET

</Trace>
<Trace Tag="EwsResponse" Tid="10" Time="2017-02-20 15:51:16Z" Version="15.00.0847.030">
  <?xml version="1.0" encoding="utf-8"?>
  <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
      <s:Fault>
        <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInternalServerError</faultcode>
        <faultstring xml:lang="en-US">An internal server error occurred. The operation failed.</faultstring>
        <detail>
          <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInternalServerError</e:ResponseCode>
          <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">An internal server error occurred. The operation failed.</e:Message>
        </detail>
      </s:Fault>
    </s:Body>
  </s:Envelope>
</Trace>
davster commented 7 years ago

Yep. Verified this log too. Same issue. Fix should be checked in later today.

donfmorrison commented 7 years ago

@davster Once the fix is checked in, how long before it deploys to our BE server? I'm guessing that is some kind of rolling update...

antfom commented 7 years ago

I have the same issue now. Exception message: An internal server error occurred. The operation failed.

Stack trace: at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException) at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request) at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute() at Microsoft.Exchange.WebServices.Data.FileAttachment.Load(Stream stream)

donfmorrison commented 7 years ago

@davster any updates on this?

IceDruids commented 7 years ago

Any word on when the fix will be live?

davster commented 7 years ago

The fix is currently rolling out in production world wide. Fixed builds: 947.003, 933.013 and 919.019. So if your response includes any dot build version greater than those, you have a fixed server. Time-wise? Difficult to say because your server could be on the front end of the rollout (and therefore already fixed) or it could be on the back end of the rollout. I would say WW saturation in a few days. Ill let you know if something comes up that changes that.

donfmorrison commented 7 years ago

At least one of our affected inboxes has rolled onto a patched server already. I can verify that the applied fix now allows my service account to download attachments. Closing this issue.

Just waiting for the other inboxes to get rolled to patched servers.

Thanks for your quick work, @davster