0
votes

I am looking for binding information (for WCF service) to consume EWS asmx (exchange web service) with authentication OAuth 2.0.

I am having WCF service which calls EWS asmx web service to do outlook exchange operation. This set up works fine with Outlook Exchange OnPrem set up. Now I want to migrate this for exchange online. Authentication mechanism is by using OAuth 2.0. https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth

I am able to generate token using my AppId & TenantID and call EWS without any issues from my console application. Same way I am able to generate token in my WCF service as well which calls EWS asmx however, strugging with specifying binding information in the web.config file.

I have tried all the possible options here but getting different exceptions all the time like -"The http request is unauthorized with client authentication scheme 'ntlm'. The authentication header received from server was 'Basic Realm=""'.

  • "The http request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from server was 'Basic Realm=""'.

Just one example of binding I tried

<binding name="XXXX" ....useDefaultProxy="true">
    <security mode="Transport">
        <transport clientCredentialsType="Windows" proxyCredentialsType="Basic" realm="*" />
        <message clientCredentialsType="UserName" algorithmSuite="Default" />
    </security>
</binding>

Can anyone suggest what should be the binding information in wcf service to call asmx which has OAuth2.0 authentication mechanism ?

Thanks,

1

1 Answers

0
votes

Your error is most likely that you did not enable authentication, you can find your service in iis, and then open it in Authentication.enter image description here

You need to turn off Anonymous Authentication and enable Windows Authentication.

enter image description here