I am new to Azure, I use the Azure free edition as benchmark .
I developed a webapi service that is using Blob and DocumentDb as DAL, and the webapi works perfect on my local machine.
In my azure account I open App service and I deploy the webapi on azure (using publish).
When I try to surf to my site using the url that was given by azure I receive the following crash error :
**An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:8081
Exception Details: System.Net.Sockets.SocketException: An attempt was
made to access a socket in a way forbidden by its access permissions
127.0.0.1:8081**
I checked my project and I didn't find any mention of that port or address!!!
Please help my to understand the source of this problem.
Are you using asp.net or asp.net core. For sure you have 8081 defined in your web.config or project.json and azure does allow process listening on custom port and hence the error
Are you getting some call stack in the exception? That will help identify the code which is trying to go to 8081
App Service platform execution environment is different from local. All Azure Web Apps (as well as Mobile App/Services, WebJobs and Functions) run in a secure environment called a sandbox. We could get more info about Azure Web App from Azure official document. The following is the snippet from the document.
Network endpoint listening
The only way an application can be accessed via the internet is through the already-exposed HTTP (80) and HTTPS (443) TCP ports; applications may not listen on other ports for packets arriving from the internet.
However, applications may create a socket which can listen for connections from within the sandbox. For example, two processes within the same app may communicate with one another via TCP sockets; connection attempts incoming from outside the sandbox, albeit they be on the same machine, will fail. See the next topic for additional detail.
Local Address Requests
Connection attempts to local addresses (e.g. localhost, 127.0.0.1) and the machine's own IP will fail, except if another process in the same sandbox has created a listening socket on the destination port.
Rejected connection attempts, such as the following example which attempts to connect to 127.0.0.1:80, from .NET will result in the following exception:
Exception Details: System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 127.0.0.1:80
Related
I have an Azure App that uploads files to another server through SFTP (port 22) using SSH.NET. I confirmed that everything works fine on my local machine, but after deploying to Azure App Service and when trying to connect to the SFTP server from the app, I get this error message.
An attempt was made to access a socket in a way forbidden by its access permissions.
I made sure that the SFTP server accepts all the Azure App Service outbound IP addresses, and I do not have any outbound rules set up on the Azure App Service.
I thought this could be my service plan issue, so I upgraded the App service plan to S1 from the free plan, but still no luck.
I tried connecting to the SFTP server with Kudu, but it is working.
So...it is not the rule issue? I'm lost.
Any ideas why the SFTP connection is not working from Azure App Service?
I am making a Winforms app that must connect to a ASP.NET WebApi web service that I also made. When I connect to the web service from my computer the Winforms app works, but when I install the Winforms app on some computers it fails to connect to the web service with the following exception:
System.IO.IOException: Can not write data to the transport connection:
The interruption of an existing connection has been forced by the
remote host
The problem is that this error might be due to a connection error or due to bugs in either the Winforms app or the web service and I have no idea what might be the cause. I can connect to the server where the web service is hosted. Are there any server logs that I can use to see what might be the cause of this error and if there are, where do I check them?
I have an application containing a WCF Data Service using SSL. I have a domain level certificate and a localhost certificate. I am using Local IIS to host the data service. I can access the WCF Service on my computer from another computer using
https://mycomputer.mydomain.com/MYDataService/ServiceName.svc
When I try that on my computer, it says it can't establish a secure connection. From my computer, I can use
https://localhost/MYDataService/ServiceName.svc
and it works. This is fine most of the time, but I have a windows forms application that I use for testing and some maintenance tasks. It is part of the solution containing the web service. To configure the web service, I use the Add Service Reference function and use the Discover feature. It configures the service fine as connecting to localhost. When I run the program, I get the following error:
Could not establish trust relationship for the SSL/TLS secure channel with authority 'mycomputer.mydomain.com'.
I have looked at the Configure Service Reference settings and it says localhost, but according to the error, the client is somehow trying to connect to the actual computer name. Has anyone run into this before?
I have an ASP.NET MVC website deployed as an Azure Website and every few days I keep getting errors like this:
System.Net.Sockets.SocketException: An operation on a socket could not
be performed because the system lacked sufficient buffer space or
because a queue was full
Once I start getting these errors the entire site goes down and it seems like all the outgoing ports have been exhausted. I have to change the capacity of the Azure website to get it to restart and clean out the ports so it will start working again.
How can I figure out what is eating up these ports? Is there tracing I can use for an Azure website? I don't have the ability to remote desktop into a machine since it is a hosted service. Some of the services that would be using outgoing ports are:
Making SQL Server calls with Entity Framework
Pulling down and caching assets from Azure Blob Storage with the Image Resizer plugin
Sending email via SMTP through SendGrid
I have a silverlight application that is communicating with a server hosted in cloud. The application works properly when the server is listening on localhost, but when I make it listen on the server port and make my client access the socket, I get the error "Access denied"
Digging deep, I also found the error in ScopeId resolution
Error Code: 10045
e.RemoteEndPoint. Address.ScopeId threw an exception
The attempted operation is not supported for the type of object referenced.
at System.Net.IPAddress.get_ScopeId()
Thank You
"In Silverlight version 4 for a connection request using System.Net.Sockets, an application can choose instead to retrieve the policy file via the HTTP protocol on TCP port 80 instead of the custom TCP protocol on port 943. This allows HTTP servers that are already running HTTP services to authorize socket connections from Silverlight applications without having to deploy a new TCP service on the machine and open a port through a firewall for port 943."
http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx