Ошибка токена аутентификации Facebook SDK 5+: попытка подключения не удалась, поскольку подключенная сторона не ответила должным образом через некоторое время - PullRequest
1 голос
/ 27 августа 2011

У меня есть проблема, которую я пытаюсь исправить с утра (теперь более 8 часов). Я получил содержимое куки-файла facebook, нашел токен авторизации, который сам по себе отлично работает в браузере

https://graph.facebook.com/me?access_token=201856003211297|2.AQAHJg3GugHIHhec.3600.1314442800.1-100002411647354|RAylZSUax4pdKcIt--QruS-Qcgc

Но

Всякий раз, когда я пытаюсь получить информацию о пользователе, веб-страница очень хорошо падает с ошибкой ниже.

Я пытался читать со страницы, используя веб-запрос:

    'Dim inputFile As String = "https://graph.facebook.com/me?access_token=" & access_token
    'Dim sDiskFile As String = "auth.txt"

    'Dim _wrequest As WebRequest = WebRequest.Create(inputFile)
    'Dim _wresponse As WebResponse

    '_wresponse = _wrequest.GetResponse()

    'Dim _stream As Stream = _wresponse.GetResponseStream()

    'Dim oReader As New StreamReader(_stream, Encoding.ASCII)

И он вылетел с той же ошибкой. Я решил попробовать Facebook SDK 5 и происходит та же ошибка:

    Dim access_token As String = GetFacebookTokenFromCookie()
    If access_token = "" Then
        litUser.Text = "<fb:login-button perms='email'>Login with Facebook</fb:login-button>"
    Else

        Dim app As New DefaultFBApp
        Dim _ctx As New FacebookWebContext(app)

        Dim fb As New Facebook.FacebookClient(app)
        fb.AccessToken = access_token

        Dim parameters As New Dictionary(Of String, Object)()
        parameters("fields") = "id,name"

        Dim result As Object = fb.Get(parameters)

        Dim id = result.id
        Dim name = result.name
        Dim firstName As String = result.first_name
        Dim lastName = result.last_name
        Dim link = result.link
        Dim username = result.username
        Dim gender = result.gender
        Dim male = result.locale
        litUser.Text = "Welcome " & firstName
    End If

DefaultFBApp is:

    Public Class DefaultFBApp
        Implements Facebook.IFacebookApplication

Со всеми добавленными полями, необходимыми для реализации, и ключом API и секретным ключом.

Та же ошибка:

Server Error in '/' Application.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 69.171.224.21:443

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 69.171.224.21:443

Source Error:

Line 25:             parameters("fields") = "id,name"
Line 26:             
Line 27:             Dim result As Object = fb.Get(parameters)
Line 28:  
Line 29:             Dim id = result.id


Source File: masterpage.master    Line: 27

Stack Trace:

[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 69.171.224.21:443]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
   System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224

[WebExceptionWrapper: Unable to connect to the remote server]
   FluentHttp.HttpHelper.OpenRead() +191
   Facebook.FacebookClient.Api(String path, IDictionary`2 parameters, HttpMethod httpMethod, Type resultType) +253
   Facebook.FacebookClient.Get(IDictionary`2 parameters) +44
   ASP.masterpage_master.Page_Load(Object sender, EventArgs e) in E:\kunden\homepages\6\d364763622\www\wsb6301158401\masterpage.master:27
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Информация о версии: Microsoft .NET Framework Версия: 2.0.50727.5446; ASP.NET версия: 2.0.50727.5420

Любая помощь будет в основном оценена

...