none
EWS Exchange on premise 2019 RRS feed

  • Question

  • Hello ,

    for a client we developed a c# console application which has ran for the last 5 years twice a day using EWS managed api.

    The application was built to syncronize contacts among 2 mailboxes , a master and a slave one.

    It worked well until we upgraded the exchange server (worked trouh exchange 2010-2013 and 2016 ) to 2019.

    Now the EWS managed api can't connect to the server.

    I've been reading around that 2019 EWS only supports oAuth authentication , is that true ? 

    The application is running inside the client's network , therefore there is no need to implement such an authentication as oAuth for secuirity sake. I've also been reading that we should use Graphs instead of EWS , but i don't think Graphs work on 2019 on premise ... 

    How should i proceed to get my application start working again ? Any feedback would be much appreciated.

    Thanks

    Marco

    Monday, March 9, 2020 1:57 PM

Answers

  • If there are no Firewall type issue its sounds like maybe it could be TLS related as 2019 will only allow you to connect using TLS 1.2. It maybe worth trying to add

    System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

    to your code to ensure it is using TLS 1.2 when it connects. You can use fiddler to have a look at connect request to the server and you should see something like

    A SSLv3-compatible ClientHello handshake was found. Fiddler extracted the parameters below.

    Version: 3.3 (TLS/1.2)

    if its using TLS 1.2

    Cheers
    Glen

    Tuesday, March 10, 2020 11:34 PM

All replies

  • *UPDATE*

    I just found out that the program moved onto the exchange 2019 server it's working , so it's not a compatibility issue with exchange 2019 , but more like a windows firewall issue ...

    The ports 443 and 444 are open , but the program form outside the server still not working , i am still very puzzled.

    Monday, March 9, 2020 3:56 PM
  • >>I've been reading around that 2019 EWS only supports oAuth authentication , is that true ?

    No that's for Office365 that won't support Basic Auth from Oct, with 2019 oAuth is really only supported when using Hybrid see https://docs.microsoft.com/en-us/office365/enterprise/configure-exchange-server-for-hybrid-modern-authentication .

    I would suggest doing some test connection with https://testconnectivity.microsoft.com/ and also try using the EWSEditor https://github.com/dseph/EwsEditor/releases these at least allow you to test EWS is working outside anything happening in the Application. 

    Also you should include any error message you receive as that generally tell people what is happening.

    Cheers

    Glen

    Tuesday, March 10, 2020 12:03 AM
  • Thank you Glen for the clarification over the oAuth, much appreciated.

    I already tried EWSEditor : on the exchange server is working like my program does.

    On the terminal server ( on which my programm should run ) the EWSEditor  returns this error message ( which is the same my program returns ) sorry but it's partially in italian : 

    Exception details:
    Message: The request failed. Connessione sottostante chiusa: Errore imprevisto durante un'operazione di invio..
    Type: Microsoft.Exchange.WebServices.Data.ServiceRequestException
    Source: Microsoft.Exchange.WebServices
    Stack Trace:
       in Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) in C:\test\ews-managed-api-master\ews-managed-api-master\Core\Requests\ServiceRequestBase.cs:riga 755
       in Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request) in C:\test\ews-managed-api-master\ews-managed-api-master\Core\Requests\ServiceRequestBase.cs:riga 640
       in Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute() in C:\test\ews-managed-api-master\ews-managed-api-master\Core\Requests\SimpleServiceRequestBase.cs:riga 55
       in Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute() in C:\test\ews-managed-api-master\ews-managed-api-master\Core\Requests\MultiResponseServiceRequest.cs:riga 132
       in Microsoft.Exchange.WebServices.Data.ExchangeService.InternalConvertIds(IEnumerable`1 ids, IdFormat destinationFormat, ServiceErrorHandling errorHandling) in C:\test\ews-managed-api-master\ews-managed-api-master\Core\ExchangeService.cs:riga 4176
       in Microsoft.Exchange.WebServices.Data.ExchangeService.ConvertIds(IEnumerable`1 ids, IdFormat destinationFormat) in C:\test\ews-managed-api-master\ews-managed-api-master\Core\ExchangeService.cs:riga 4189
       in EWSEditor.Common.Extensions.ExchangeServiceExtensions.TestExchangeService(ExchangeService service) in C:\this\GitHub\EwsEditor\EWSEditor\Common\Extensions\ExchangeServiceExtensions.cs:riga 183
       in EWSEditor.Forms.ServiceDialog.BtnOK_Click(Object sender, EventArgs e) in C:\this\GitHub\EwsEditor\EWSEditor\Forms\Dialogs\ServiceDialog.cs:riga 282
       in System.Windows.Forms.Control.OnClick(EventArgs e)
       in System.Windows.Forms.Button.OnClick(EventArgs e)
       in System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       in System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       in System.Windows.Forms.Control.WndProc(Message& m)
       in System.Windows.Forms.ButtonBase.WndProc(Message& m)
       in System.Windows.Forms.Button.WndProc(Message& m)
       in System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    Exception details:
    Message: Connessione sottostante chiusa: Errore imprevisto durante un'operazione di invio..
    Type: System.Net.WebException
    Source: System
    Stack Trace:
       in System.Net.HttpWebRequest.GetResponse()
       in Microsoft.Exchange.WebServices.Data.EwsHttpWebRequest.Microsoft.Exchange.WebServices.Data.IEwsHttpWebRequest.GetResponse() in C:\test\ews-managed-api-master\ews-managed-api-master\Core\EwsHttpWebRequest.cs:riga 132
       in Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) in C:\test\ews-managed-api-master\ews-managed-api-master\Core\Requests\ServiceRequestBase.cs:riga 745
    Exception details:
    Message: Impossibile leggere dati dalla connessione del trasporto: Connessione in corso interrotta forzatamente dall'host remoto.
    Type: System.IO.IOException
    Source: System
    Stack Trace:
       in System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
       in System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
    Exception details:
    Message: Connessione in corso interrotta forzatamente dall'host remoto
    Type: System.Net.Sockets.SocketException
    Source: System
    Stack Trace:
       in System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
       in System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)


    Tuesday, March 10, 2020 7:55 AM
  • If there are no Firewall type issue its sounds like maybe it could be TLS related as 2019 will only allow you to connect using TLS 1.2. It maybe worth trying to add

    System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

    to your code to ensure it is using TLS 1.2 when it connects. You can use fiddler to have a look at connect request to the server and you should see something like

    A SSLv3-compatible ClientHello handshake was found. Fiddler extracted the parameters below.

    Version: 3.3 (TLS/1.2)

    if its using TLS 1.2

    Cheers
    Glen

    Tuesday, March 10, 2020 11:34 PM
  • Hello Glen ,

    sorry for the delay , but Corona Virus is making things a little messy around here ...

    Anyway the last answer you gave to me worked perfectly , thank you so much!

    Have a nice day!

    Friday, March 13, 2020 9:40 AM