Login Time between users is taking too long to authenticate

Hi ,

I'm using EWS API 2.2 to interact with Exchange 2013.

I have several users on my exchange server and I've noticed that every time I tried to login it is taking too long between my users.

I have a loop for my users and for each one of them I'm reading their inbox.

The code that I use to connect is the below

  ServicePointManager.ServerCertificateValidationCallback = New  _
                  RemoteCertificateValidationCallback(AddressOf CertificateValidationCallBack1)

 Dim Myexchange As New ExchangeService(Me.ExchangeVersion1)

                Dim MyCredentialCache As System.Net.CredentialCache

                MyCredentialCache = New System.Net.CredentialCache
                Dim credential As ICredentials = CredentialCache.DefaultNetworkCredentials
                If Me.UseDefaultCredentials = "N" Then
                    MyCredentialCache.Add(New System.Uri(Me.WebServiceUrl), _
                                    Authentication_Type, _
                                    New System.Net.NetworkCredential(UserName, PassWord, Domain) _
                                    )
                Else
                    MyCredentialCache.Add(New System.Uri(Me.WebServiceUrl), Authentication_Type, credential)
                End If

                Myexchange.Credentials = MyCredentialCache
                Myexchange.Url = New Uri(Me.WebServiceUrl)

                If Me.UseTrace Then
                    Dim TC As New EWSTrace.TraceListener
                    TC.TracePath = Me.TracePath
                    Myexchange.TraceFlags = TraceFlags.All
                    Myexchange.TraceEnabled = True
                    Myexchange.TraceListener = TC
                End If


                MyExchangeService = Myexchange

Private Shared Function CertificateValidationCallBack1(ByVal sender As Object, ByVal certificate As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal chain As System.Security.Cryptography.X509Certificates.X509Chain, ByVal sslPolicyErrors As System.Net.Security.SslPolicyErrors) As Boolean
        Return True
    End Function

As you can see from above I'm using the default classic code which works of course.

But When I change between the users it will take me to authenticate two minutes to connect for each one of them.

Is it something that I must do in my exchange code or something that I must change in my exchange installation.

Everything is installed on my network , I'm not using something like office 365.

thank you

February 10th, 2015 5:05am

What do your traces show can you post the output eg where is the time being consumed ? are you using Autodiscover ? are you rediscovery for every user ? it sounds like you have a request that is timing out (default timeout is 90 Seconds).

Cheers
Glen

  • Marked as answer by zakkar 2 hours 46 minutes ago
Free Windows Admin Tool Kit Click here and download it now
February 11th, 2015 7:47am

Hi Glen ,

I will send you the logs as soon as I am able to connect to my client.

You talked about Autodiscover.

Can you give more information about this ? Is it something that I need to do in the client side ? Exchange side ?

thank you

February 11th, 2015 12:39pm

Auto discover is the method of discovering the webservice URL https://msdn.microsoft.com/en-us/library/office/jj900169%28v=exchg.150%29.aspx

 eg in your code

  Myexchange.Url = New Uri(Me.WebServiceUrl)

so wherever Me.WebServiceUrl is coming from

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
February 11th, 2015 7:51pm

Hi Glen ,

My Client program was in a different domain from the exchange and therefore it was taking too long to authenticate. What I did is to install my client program in the domain where the Exchange lies and it solved my problem. Since this worked Glen I will leave it as it is and perhaps experiment with the Autodiscover because as far as I can see my client hasn't setup correctly the Autodiscover service and it seems to need an experts ' job to do so.

It is working now without any problems and delays so I'm good.

Appreciate once again you guidance and your help.

thank you

  • Marked as answer by zakkar 2 hours 46 minutes ago
February 12th, 2015 4:05am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics