2012-07-04 49 views
0

我一直在尋找這個錯誤,我不斷找到並找不到合適的解決方案。這似乎是這個人所獨有的。有誰知道我爲什麼得到錯誤? 非常感謝時間。System.Action無法加載

public void uploadPhoto(Stream photoStream, string photoName) 
{ 
var credentials = new OAuthCredentials 
     { 
      Type = OAuthType.ProtectedResource, 
      SignatureMethod = OAuthSignatureMethod.HmacSha1, 
      ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader, 
      ConsumerKey = TwitterSettings.consumerKey, 
      ConsumerSecret = TwitterSettings.consumerKeySecret, 
      Token = TwitterSettings.accessToken, 
      TokenSecret = TwitterSettings.accessTokenSecret, 
      Version = "1.0a" 
     }; 


     RestClient restClient = new RestClient 
     { 
      Authority = "https://upload.twitter.com", 
      HasElevatedPermissions = true, 
      Credentials = credentials, 
      Method = WebMethod.Post 
     }; 
     RestRequest restRequest = new RestRequest 
     { 
      Path = "1/statuses/update_with_media.json" 
     }; 

     restRequest.AddParameter("status", tbxNewTweet.Text); 
     restRequest.AddFile("media[]", photoName, photoStream, "image/jpg"); 

} 

    restClient.BeginRequest(restRequest, new RestCallback(PostTweetRequestCallback)); 
} 


private void PostTweetRequestCallback(RestRequest request, Hammock.RestResponse response, object obj) 
{ 
     if (response.StatusCode == System.Net.HttpStatusCode.OK) 
     { 
     //Success code 
     } 
} 

我得到一個錯誤:

restClient.BeginRequest(restRequest, new RestCallback(PostTweetRequestCallback)); 

TypeLoadException了未處理 未能從程序集加載類型「System.Action「mscorlib程序,版本= 3.7.0.0,文化=中立,公鑰= 969DB8053D3322AC」。

+0

嗨湯姆。現在我面臨着同樣的問題。你能告訴我你是如何解決這個問題的? – Vijay

回答