I’m setting up a ASP.NET MVC project in Azure and their will be a connection to my Tomcat webserivce.
In the controller I do a HttpWebRequest to the webservice but when I go to the website in Azure, I get the following message:
System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions
If I do a jQuery request to the server in my MVC View, I get a message from the webservice.
Is the problem the webserivce or maybe CORS (Cross-Origin Resource Sharing) problem?
Anybody got a idea/solution?
A
HttpWebRequestexecutes on the server, while a jQuery requests executes locally on the client. In the comments on your question I can see you are trying to access a local IP address: 192.168.50.205. This explains why the jQuery requests works and theHttpWebRequestdoesn’t: you can access that IP address from your computer, so the local jQuery requests works, but your server can’t access that IP address so theHttpWebRequestfails.