I just downloaded C# SDK and ASP.NET MVC sample, modified it to work with 4.2.1. (web config facebookSettings parameters etc.), created my Facebook application and tried to run it. Click to facebook login button - ok, entering credentials into facebook popup - ok, allowing access for my application - ok, and then I get this error:
System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 66.220.146.47:443
var app = new FacebookApp();
if (app.Session == n开发者_JS百科ull)
{
// The user isnt logged in to Facebook
// send them to the home page
return RedirectToAction("Index");
}
// Get the user info from the Graph API
dynamic me = app.Api("/me"); // EXCEPTION THROWN HERE
ViewData["FirstName"] = me.first_name;
ViewData["LastName"] = me.last_name;
The app
object is OK I think (containing settings params, session object with access token and my facebook userid, etc.)
I am using local development address http://myappdev.local
(set to 127.0.0.1
in hosts file). The same address is set in my facebook app settings, also domain myappdev.local
- Can this be the problem? I have seen examples using localhost:1234
in some tutorials.
If you're getting the same error in Windows 8 development, it could be that you haven't enabled access over Private Networks in your Package.appxmanifest
file:
Solved... my bad - my firewall was "silently" blocking ISS worker process from connecting on port 443... I hope that at least I save somebody from the same mistake :)
I know this post is from 2011, but it's still the first result for the google search matching its title verbatim, which happens to be the exact error code ;). Anywho, I thought I'd add my two cents for anybody else having the error, as my resolution was similar yet different.
The problem was on my end as well. I was using an smtp client to send mail, though. I run PeerBlock, and it blocks suspicious IPs. I saw it was blocking one of the IPs I was sending to before it left my network. A simple rule exception and the problem was solved.
TL;DR Firewalls and other internet security filtering tools should all be checked to make sure this problem isn't caused on your end.
I've been running into a similar issue when I tried to run a simple http web application listening on port 80 written in Go (golang) on Windows 10 Home.
After doing some research I found out that for some reasons the "World Wide Web Publishing Service" (W3SVC) was running. Stopping and disabling the service solved my issue.
I never used this service. I guess a Visual Studio Community 2013 installation in the past installed and enabled this service. When I encountered the problem for the first time I thought it's a privilege issue as it's the case on Linux systems where applications listening on ports < 1023 must be run with root privileges. But in Windows 1023 this is not the case.
After all, finding this trivial issue costed me about 2 hours, that's why I post this answer to this rather old thread.
Basically this is a summary of what I did:
1) Google for the error message (as fully contained in the question of this thread).
- To many issues not related to my specific issues have been returned.
- I didn't find a concrete answer that solved my problem.
- However, I found hints for further analysis.
2) The first hint was using netstat.
netstat -o -n -a | findstr 0.0.0.0:80
netstat -o -n -a | findstr 127.0.0.1:80
It turned out that the process with Id 4 was listening on port 80.
3) Lookup Process #4 on the Details tab in the Taskmanager.
This showed that System (NT Kernel & System) is involved.
4) Trying to access port 80 on localhost using PUttY with Telnet to port 80.
(make sure to set **Closing on exit* to never)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Verb</h2>
<hr><p>HTTP Error 400. The request verb is invalid.</p>
</BODY></HTML>
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Thu, 05 Oct 2017 13:13:29 GMT
Connection: close
Content-Length: 326
5) The information collected so far didn't provide a concrete hint but allowed me to do more specific searches on Google. Now the information returned from Google indicated that most likely some kind of system services listening on port 80 might be the source of the issue.
6) Now it was easy to look for such running services in the service manager. The first one I found that could likely be the source of the issue (as it contained WWW in its name) was "WWW-Publishingdienst" (on my computer in German) which stands for "World Wide Web Publishing Service" on systems with English language settings. I stopped the service and - Voila! It was the cause of the issue.
Not sure what all this was, but ipconfig /release && ipconfig /renew
seemed to work for me.
faced a similar problem, I checked everything that might cause the error, this includes the right port to use, firewall settings even the operating system of the server compatibility issues, only to find out that the anti-virus is the one causing it,
Make sure to disable the feature of your anti-virus that is blocking the socket connection, or add to exemption the specific .exe or program you want not to be blcocked.
Mine uses McCafee and I uncheck the feature in it that blocks socket connection for sending mails and it worked.
I run a MySQL DB locally and I had a similar problem. I did all the steps shown in posts related to the same issue:
- Disabled firewall
- Disabled antivirus
- Reset TCP/IP stack
- Restarted computer
- Verified connection string
None of these worked. I found out that the issue for me was my VPN (Astrill). For some reason it was causing these localhost connections to fail. Disconnecting from VPN fixed my problem.
精彩评论