in the 42 line of Default.espx.cs I got error:
"SocketException: No connection could be made because the target machine actively refused it"
Do you maybe know the reason? It's really important to solve this issue.
You should check the URL of the service. In the original file it's on line 22:
service.Url = new Uri("https://outlook.office365.com/ews/exchange.asmx");
The error suggests that the application is not able to connect to port 443 on the specified server. When using a custom URL, you should check that an Exchange server is running there and that no firewall is blocking access.
I use exactly the same url in my code.
I mean, I didn't change anything in your code and it still generates that exception... Do you have any ideas where I can check for mistakes?
This is not a problem in the code, it's a network issue. Your computer isn't able to open a TCP/IP connection to the target machine. You'll need to contact your network administrator to resolve the problem. The connection may be blocked by a firewall (intentionally or unintentionally).
I created a Console application in C# and used the same URL in configuration of ExchangeService and it works... The problem occurs only with ASP.NET projects.
It might also be a proxy issue:
Yes, thank you so much. I've checked in WireShark the IP address my app was trying to connect with. Then I set that address (with another port) as a proxy and suddenly it started to work. Thank you!
Great, thanks for the update!