0

I have a ASP .NET application hosted as a WebApp in Azure and a Xamarin client app that consumes that WebApi in Azure. As soon as I changed my webapi to an Azure WebApp, which was previously hosted in non-azure VM and it was working fine, my Xamarin client start getting "The socket is not connected" exception on every endpoint call, although WebSockets are enable in the Webapp's settings page.

The Xamarin Forms app is using Refit to call those .NET endpoints.

Really need some help here considering I'm pretty happy with the idea of ​​not depending on VM to host this application, just need to correct this problem to get it.


I've enabled Azure WebApps CORS and the problem still persists, I have also tried to disable Azure CORS and allowed all origins/headers in my app Cors, however I keep getting "The Socket isn't Connected' on every webapi call.

I realized that the error only occurrs when I have a SSL address binding to the webapp, when the GET goes directly to xxxx.azurewebsites.net it works fine (it's able to connect), although it doesn't mean much to me because the app was hosted in IIS (on a VM) using this same certificate and it was working.

Sven
  • 97,248
  • 13
  • 177
  • 225

1 Answers1

0

If you are coming from another domain you will to configure Cross-Origin Resource Sharing (CORS) on your web app. Without CORS enabled, you will not be able to connect.

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-rest-api

Ken W MSFT
  • 594
  • 2
  • 6