[Resolved] 417 (Expectation Failed) when "Leveraging the Facebook API in 5 minutes"

Oct 20, 2009 at 12:30 PM
Edited Oct 20, 2009 at 3:38 PM

I'm running with Visual Basic Express 2008, just downloaded from MS and the Facebook Developer Toolkit v2.1, also just downloaded. I already have a facebook desktop app that works fine using a python api and now I'm trying to develop a desktop app using this toolkit...

Trying to follow the instructions in the User's Guide.pdf, I've created a VB app, added the facebook and facebook.desktop references, added the controls -- all without issue. I have set the ApplicationKey and Secret to the same values that I (successfully) use with my python app.

But, when the VB app tries to run the line:

    FriendList1.Friends = FacebookService1.friends.getUserObjects()

it returns 417 (Expectation Failed):

System.Net.WebException was unhandled
  Message="The remote server returned an error: (417) Expectation failed."
  Source="System"
  StackTrace:
       at System.Net.HttpWebRequest.GetResponse()
       at facebook.API.postRequest(String requestUrl, String postString)
       at facebook.API.SendRequest(IDictionary`2 parameterDictionary, Boolean useSession)
       at facebook.friends.getUserObjects(Int64 uid, Int64 flid)
       at facebook.friends.getUserObjects()
       at FBtest.Form1.Form1_Load(Object sender, EventArgs e) in <path to>Form1.vb:line 11
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at FBtest.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

I get the same exception if I put FacebookService1.ConnectToFacebook() instead of FriendList1.Friends = FacebookService1.friends.getUserObjects().

Where am I going wrong / what am I missing?

Oct 22, 2009 at 7:59 AM

Ok, here's another data point...

I've got the app working on another PC (same VB version and same toolkit version). The only differences are:

  1. The PC it works on is running Vista; the one it gets the 417 response is running XP.
  2. The PC it works on is my home PC, connected 'direct' to the internet; the one it fails on is connected through a proxy.

Could it be related to the IE proxy settings confusing the toolkit somehow?

Oct 22, 2009 at 10:02 PM

It seems it was the proxy settings. I disabled them and everything's fine.