0

我一直在研究这个我不断遇到的错误,但找不到正确的解决方案。好像对这个人来说是独一无二的。有谁知道我为什么会收到错误?非常感谢时间。

    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 无法从程序集“mscorlib,版本=3.7.0.0,文化=中性,PublicKeyToken=969DB8053D3322AC”加载类型“System.Action”。

4

1 回答 1

0

我找到了这个答案。它帮助我解决了同样的问题,希望它可以帮助你!

TypeLoadException 说'没有实现',但它已实现

于 2012-07-04T03:00:05.307 回答