Free Support Forum - aspose.com

Exception when calling EWSClient.GetEWSClient in version 20.1.0

Hi,

When I call the following:
var client = EWSClient.GetEWSClient(“https://outlook.office365.com/ews/exchange.asmx”, credential);

I get the following exception:
System.InvalidOperationException : WebServiceBindingAttribute is required on proxy class

This has only started happening with version 20.1.0, not with 19.12.0

Full exception is:
System.InvalidOperationException : WebServiceBindingAttribute is required on proxy class ' '.
at ​ …ctor( ​ )
at ​ .(String )
at …ctor()
at Aspose.Email.Clients.Exchange.WebService.Schema_2016.ExchangeServiceBindingBase…ctor()
at Aspose.Email.Clients.Exchange.WebService.EWSClient.GetEWSClient(String mailboxUri, ICredentials credentials, WebProxy proxy)

Any ideas?
Thanks

@asruw,

I have tried using following sample code on my end and tried loading my account. There is no issue while using client on my end by employing Aspose.Email for .NET 20.1.

IEWSClient client = EWSClient.GetEWSClient(“https://outlook.office365.com/ews/exchange.asmx”,
“username”,“passsword”,"");

I’m not sure what to say.
I’m getting this error every time I connect to the office365 url. It happens on my mac workstation, it happens in production in Azure.
I’ve tried different accounts. I’ve even tried putting in just “username” and “password” for the credentials and this error still happens.
I’m running dotnet core 2.2, however I’ve tried just creating a simple dotnet core 3.1 console app with just one line that calls GetEWSClient and I’m still getting the this same exception.

System.InvalidOperationException: WebServiceBindingAttribute is required on proxy class ’ '.
at ​ …ctor( ​ )
at ​ .(String )
at ​ .(Type , String )
at …ctor()
at Aspose.Email.Clients.Exchange.WebService.Schema_2016.ExchangeServiceBindingBase…ctor()
at …ctor()
at Aspose.Email.Clients.Exchange.WebService.EWSClient.GetEWSClient(String mailboxUri, ICredentials credentials, WebProxy proxy)
at Aspose.Email.Clients.Exchange.WebService.EWSClient.GetEWSClient(String mailboxUri, String username, String password, String domain)

@asruw,

It’s strange as I have not been able to reproduce the issue. Can you please provide a working sample project along with test account credentials. I will try that on my end and log issue in our issue tracking system based on that if I am able to reproduce the issue.

Here is a test project which just calls GetEWSClient with username and password.
AsposeTest.zip (2.1 KB)

It should just throw an error with the credentials not being valid, but I get the same WebServiceBindingAttribute is required on proxy class.
I’ve tried running this on both windows and on mac with the same exception, only with .net core. Not the full framework.
I am connecting to office365 exchange service from Australia. If this works for you then I it must be some sort of network issue as I’ve only tried this on networks in Australia.

Actually this error does not occur in 19.12.0. It only occurs in 20.1.0

@asruw,

I have worked with the sample project on my end and have been able to observe the issue on my end. With normal .NET based application there is no issue. However, in .NET Core 3.1 based application share by you, I have observe the issue. An issue with ID EMAILNET-39725 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be addressed.

Thank you @mudassir.fayyaz