C# linqToTwitter not posting in production. No errors reported. Ideas?


The code below is posting from developers machine to our twitter feed yet when moved to production the code executes without exception but the tweets never show up on the feed. Any ideas for a solution? Has this ever happened to anyone before? Thanks.
var tAuth = new SingleUserAuthorizer
Credentials = new SingleUserInMemoryCredentials
ConsumerKey = AppId,
ConsumerSecret = AppKey,
TwitterAccessToken = AuthTokenKey,
TwitterAccessTokenSecret = AuthToken

            var tCtx = new TwitterContext(tAuth);


A few things to check:

  1. Do you have a try/catch around the code to catch and log exceptions?
  2. Are you looking at the account that owns the tokens?
  3. Maybe add a log statement to verify that block of code is executing.
  4. Is this a Web app? InProc SessionState is a common gottcha.

If the tweet is not successful, it means there was an error. One of the most common errors in this case would be an HTTP 401, which occurs for a number of reasons. A lot of times, when your dev environment works well, but the server doesn’t, you could have a clock mismatch. Your server time needs to match Twitter’s server time because the OAuth signature relies on a timestamp that is only good for a small window of time. Here’s a FAQ I wrote with other reasons a 401 could occur: