0

I am using Linq To Twitter and getting an exception when try to fetch followers. Below is my code and the exception.

   private static async Task<List<TwitterData>> GetTwitterFollowers(
            ulong twitterUserId, SingleUserAuthorizer auth, int? maxFollowers)
        {

            var follower = maxFollowers ?? 15000;

            try
            {
                var twitterCtx = new TwitterContext(auth);
                var followers = await twitterCtx.Friendship
                                          .Where(f => f.Type == FriendshipType.FollowersList
                                              && f.UserID == twitterUserId.ToString())
                                          .Select(f => new TwitterData()
                                          {

                                              Followers = f.Users.Where(t => !t.Protected).Take(follower).Select(s => s).ToList()
                                          }).FirstOrDefaultAsync();


                return GetFollowersList(followers.Followers, ref twitterCtx);
            }
            catch (Exception ex)
            {
                return null;
            }

        }

Exception

  InnerException = {"The remote name could not be resolved: 'api.twitter.com'"}

Please suggest

Ammar Khan
  • 346
  • 1
  • 9
  • 27

1 Answers1

1

api.twitter.com is the host name of the Twitter API. When LINQ to Twitter makes a query, It uses this as part of the base URL to communicate with Twitter and then adds any endpoint specific paths and parameters. This indicates a network problem where the system the query is run on can't communicate with Twitter. I've seen similar problems in Windows Phone apps running in the Emulator where the emulator isn't connected to the Internet. I've also seen it occur when Fiddler is running and not configured properly. Another possibility is a proxy - if your network has a proxy, you can use the WebProxy property of the TwitterContext instance.

Joe Mayo
  • 7,501
  • 7
  • 41
  • 60
  • Sir, can you check your email. I am the person who tweet you last night and send an email to you in which I brief you about my problem. I run into this issue http://stackoverflow.com/questions/22069734/dll-stops-executing-after-adding-config-block?noredirect=1#comment33467813_22069734 – Ammar Khan Feb 28 '14 at 20:12
  • The code stop executing after which it try to fetch follower from the above code. By the way "The remote name could not be resolved" issue get resolved – Ammar Khan Feb 28 '14 at 20:14