2010-03-18 44 views
1

我開發了一個簡單的ASP.NET應用程序,它工作正常,但現在我無法獲取用戶信息;我得到這個消息:FB連接:(417)期望失敗

The remote server returned an error: (417) Expectation failed.

,這裏是我使用的代碼:

Dim FBUser As Facebook.Schema.user = Nothing 
Dim connectSession As Facebook.Session.ConnectSession 
Dim FBApi As Api 

connectSession = New Facebook.Session.ConnectSession(ConfigurationManager.AppSettings("AppKey"), ConfigurationManager.AppSettings("AppSecret")) 

If connectSession.IsConnected() Then 
    FBApi = New Api(connectSession) 
    Try 
     FBUser = FBApi.Users.GetInfo() 
     '' do some work 
    Catch ex As Exception 
     FBUser = Nothing 
     '' other work 
    End Try 
End If 

這實在是令人困惑,因爲它只是工作罰款2個星期了!

感謝

+0

這可能與您在代理後面測試應用程序有關。 – 2012-06-10 15:34:25

+0

也許我當時是在我的ISP設置的透明代理之後,但我無法確認它! – FearUs 2012-10-15 20:12:40

回答

3

我張貼的解決方案,後期抱歉,但它竟然是一些ISP相關的東西。將此行添加到Web配置將有助於:

<system.net> 
    <settings> 
     <servicePointManager expect100Continue="false"/> 
    </settings> 
    </system.net> 

或者它等同於代碼。

+1

該解決方案適用於我與FB連接完全無關的問題。 – Myster 2011-04-04 22:40:24