Home > database >  An attempt was made to access a socket in a way forbidden by its access permissions. (localhost:5001
An attempt was made to access a socket in a way forbidden by its access permissions. (localhost:5001

Time:09-14

I'm facing issue with my multiple project solution in .net core webAPI. I've gatewayAPI which internally makes call to different microservices via http call.

Gateway API URI exposed to outer world which has domain as azure app name but the internal calls from gateway to microservices are configured with http://localhost:5001/{apiEndPoint} which is working fine in my local machine but after deploying it on azure app service I'm getting below error:

PostToServer call URL:'http://localhost:5001/api/authservice/authenticate' with Exception message An attempt was made to access a socket in a way forbidden by its access permissions. (localhost:5001).

Can someone please help me with this, I'm new to azure and learning on my own but could not find any solution for this yet.

PS: After going through some YouTube videos and blogs I got to know we have to use AKS but I'm not confident in that.

Would really appreciate any help on this issue.

CodePudding user response:

The Gateway API you deployed to azure app service, it doesn't support custom port usage for 5001. Azure App Service only supports port 80|443(HTTP|HTTPS).

If you must use multiple ports in your actual project, then it is recommended to check whether Azure Cloud Service meets your needs. But it not the best choice.

The Best Practice:

Microservices architecture design

In short,create a Azure Gateway service, and your other microservice can be deployed in any where.(azure app service, vm or aks)

You just make sure you can access your microservices in your internal or public network environment.

If you're just learning, or the app isn't actually used by a lot of users, you can try the following suggestions:

  1. Use SignalR (not azure signalr) to replace the websocket in your current project.

  2. You have on azure app service, you can deploy your Gateway API Application to app service, and your other microservices can be deployed to Virtual Application in azure app service.

  • Related