Getting exception when trying to search

Jul 29, 2009 at 2:50 AM


I'm getting this exception - "Fault Exception was unhandled by user code" when I try to search something.

Jul 29, 2009 at 5:28 AM

Did you set your AppID at line 105 of SearchService.cs?

You can get your AppID at

Jul 29, 2009 at 5:29 AM

Correction: line 105 of SearchEnvironment.cs

Aug 3, 2009 at 3:29 AM

Good job on the SDK.  I had no trouble setting it up and getting search results in the online example or the application in my Visual Studio server, but when I click on the result links - nothing happens.  Am I missing something totally obvious or do I need to write the UI to handle the request(I haven't opened up the code and looked closely at it yet.)  I went ahead and wrote this since the Codeplex example links won't work for me.  Thanks for saving me a lot of work, Danny

Aug 4, 2009 at 5:22 AM

Only the actual textual URLs are clickable in the present implementation - Tiles and title-less thumbnails are not.

As you saw, making them active is fairly straightforward - we will likely fix this soon


Apr 28, 2010 at 7:44 PM
alessc wrote:

Did you set your AppID at line 105 of SearchService.cs?

You can get your AppID at

Wrong filename.... it's SearchEnvironment.cs

I had to search the entire solution for AppID to find it.

Another tricky item is that you have to manually select each DLL, right click to get a properties window, and click Unblock

A little documentation would help here guys!!!!!

May 7, 2010 at 10:03 PM

Howdy guys,

I echo the congrats on such an awesome API. It all works very well except for two issues that i have found.

I am still getting the fault exception as mentioned at the top of this post. I have a correctly added AppID and have no issue getting search results back until I start trying to search past page 39 of any given result set.

Here is the stack trace and the method where the error occurs:


System.ServiceModel.FaultException was unhandled by user code
  Message=Client error
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
       at Microsoft.Bing.Service.LiveSearchPortTypeClient.LiveSearchPortTypeClientChannel.EndSearch(IAsyncResult result)
       at Microsoft.Bing.Service.LiveSearchPortTypeClient.Microsoft.Bing.Service.LiveSearchPortType.EndSearch(IAsyncResult result)
       at Microsoft.Bing.Service.LiveSearchPortTypeClient.EndSearch(IAsyncResult result)
       at Microsoft.Bing.Service.LiveSearchPortTypeClient.OnEndSearch(IAsyncResult result)
       at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)

 Here is the method:

            public Microsoft.Bing.Service.SearchResponse1 EndSearch(System.IAsyncResult result) {
                object[] _args = new object[0];
                Microsoft.Bing.Service.SearchResponse1 _result = ((Microsoft.Bing.Service.SearchResponse1)(base.EndInvoke("Search", _args, result)));
                return _result;


Any help with this would be awesome as its blocking me at present.

The other issue occurs with a nullexception SearchMarshaller.cs when a webResult.DateTime is null. Simple check before cures the issue.


May 9, 2010 at 3:04 AM

Using Fiddler, you can see that there is a parameter error when the Offset is greater than 1000 which is the case when you get past the 40th page.  I can look into how we can change the UI to avoid this error.


May 9, 2010 at 5:42 AM

The new build 1.4 should fix that error.

May 9, 2010 at 1:40 PM

Cheers Michael, I will check the versions and see if it is taken care of.

May 9, 2010 at 1:58 PM

Howdy Michael,

The issue still occurs, limiting max page returns to 40 on 25 item offset/page as you would expect, both in the sample application and my own, from the link you proved I would assume this is a fixed limitation within the service provided by the SDK and nothing that anyone can really do to get around.

We either notify the user of the limitation or call for a more detailed search query if the user is still looking past 1000 results.

BTW, thanks for uploading the new version and putting in the effort with this API. It is so clean and easy to use, I am really very impressed and appreciative. VS2010 build making life easier as well ;-)





May 9, 2010 at 5:04 PM

I just updated the source code of Page.xaml.cs in the sample application to reflect the 1,000 maximum results imposed by the API.