2

We have a .NET Core web application deployed as an Azure App Service that we recently migrated from .NET Core 2.2 to .NET Core 3.1. The application makes remote API calls to a private service hosted on an Azure VM over a private IP connected with VNet Integration. There have been no changes to the application code networking layer, and we have verified all firewall rules are set to permit traffic from the App Service. The .NET Core 2.2-based deployment slots connect to the same VM (over private IP) with the same API service and the same VNet without issue. The .NET Core 3.1-based slot can also connect when we reconfigure the firewall rules and the VM to accept connections over the public, internet-facing IP address (this configuration is undesirable for security reasons). However, the .NET Core 3.1-based deployment receives the following exception when connecting via the private IP:

---> System.AggregateException: One or more errors occurred. (One or more errors occurred. (An attempt was made to access a socket in a way forbidden by its access permissions. [::ffff:10.10.4.4]:721))
---> System.AggregateException: One or more errors occurred. (An attempt was made to access a socket in a way forbidden by its access permissions. [::ffff:10.10.4.4]:721)
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions. [::ffff:10.10.4.4]:721
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.TcpClient.<>c.<ConnectAsync>b__27_1(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of inner exception stack trace ---```
  • 2
    Microsoft Support has recommended a workaround for this issue by forcing TcpClient to use IPv4 via its optional constructor's parameter: TcpClient tcpClient = new TcpClient(AddressFamily.InterNetwork) – Oleg Shmytov Jan 21 '20 at 21:18

0 Answers0