I recently started deploying my fully functional Twitter bot (which is supposed to post a new short story every day or so) to my Twitter profile. It is being invoked through a CRON job on Azure, and is hosted in an MVC 4 project.
However, when I try to run it in Azure (and remember, it works fine locally), I get the following error:
[NetworkInformationException (0x5): Access is denied]
System.Net.NetworkInformation.SystemIPGlobalProperties.GetFixedInfo() +9059627
System.Net.NetworkInformation.SystemIPGlobalProperties.get_FixedInfo() +172
System.Net.NetworkInformation.SystemIPGlobalProperties.get_DomainName() +269
System.Net.CookieContainer..ctor() +121
Hammock.Web.WebQuery.AppendCookies(HttpWebRequest request) +242
Hammock.Web.WebQuery.SetRequestMeta(HttpWebRequest request) +147
Hammock.Web.WebQuery.HandleRequestMeta(WebRequest request) +146
Hammock.Web.WebQuery.BuildPostOrPutFormWebRequest(PostOrPut method, String url, Byte[]& content) +680
Hammock.Web.WebQuery.BuildPostOrPutWebRequest(PostOrPut method, String url, Byte[]& content) +168
Hammock.Web.WebQuery.ExecutePostOrPut(PostOrPut method, String url, WebException& exception) +181
Hammock.Web.WebQuery.Request(String url, WebException& exception) +252
Hammock.Authentication.OAuth.OAuthWebQuery.Request(String url, WebException& exception) +157
Hammock.RestClient.RequestImpl(RestRequest request) +943
Hammock.RestClient.Request(RestRequest request) +74
TweetSharp.TwitterService.WithHammockImpl(RestRequest request) +83
TweetSharp.TwitterService.WithHammock(WebMethod method, String path) +120
TweetSharp.TwitterService.SendTweet(SendTweetOptions options) +782
I assume it's because it uses a port that Azure doesn't support or something similar. Or is it? I have no clue where to begin troubleshooting this, and there has been no help to find on the web when I searched for it.
Here's my code. As you can see, the access tokens and secrets are hard-coded in, and they are (like I said) working locally:
var service = new TwitterService("qwdwqdqwd", "qwdwqdqwdqwd");
service.AuthenticateWith("qwdqwdqwdqwd", "qwdqwdqwdwqd");
var status = "Collaborative short story of the day: Blah";
var response = service.SendTweet(new SendTweetOptions() {Status = status}); //crash!
What is the issue?