首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >异常-> Hammock.WindowsPhone.dll!Hammock.Silverlight.Compat.GzipHttpWebResponse.GetResponseStream()

异常-> Hammock.WindowsPhone.dll!Hammock.Silverlight.Compat.GzipHttpWebResponse.GetResponseStream()
EN

Stack Overflow用户
提问于 2012-05-22 10:41:07
回答 1查看 615关注 0票数 1

我想在我的应用程序中使用Twitter,我使用的是使用的Twitter,所以当我像这样创建rest客户机时

代码语言:javascript
复制
private void GetTwitterToken()
{
    var credentials = new OAuthCredentials
    {
        Type = OAuthType.RequestToken,
        SignatureMethod = OAuthSignatureMethod.HmacSha1,
        ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
        ConsumerKey = MyTwitter.ConsumerKey,
        ConsumerSecret = MyTwitter.ConsumerSecret,
        Version = MyTwitter.OAuthVersion,
        CallbackUrl = MyTwitter.CallbackUri
    };

    /*
    var client = new RestClient
    {
        Authority = "https://api.twitter.com/oauth",
        Credentials = credentials,
        HasElevatedPermissions = true
    };
    */

    var client = new RestClient
    {
        Authority = "https://api.twitter.com/oauth",
        Credentials = credentials,
        HasElevatedPermissions = true,
        SilverlightAcceptEncodingHeader = "gzip",
        DecompressionMethods = DecompressionMethods.GZip
    };

    var request = new RestRequest
    {
        Path = "/request_token"
    };
    client.BeginRequest(request, new RestCallback(TwitterRequestTokenCompleted));
}

private void TwitterRequestTokenCompleted(RestRequest request, RestResponse response, object userstate)
{
    Debug.WriteLine("Twitter Request Token Completed");

    _oAuthToken = GetQueryParameter(response.Content, "oauth_token");
    _oAuthTokenSecret = GetQueryParameter(response.Content, "oauth_token_secret");
    var authorizeUrl = MyTwitter.AuthorizeUri + "?oauth_token=" + _oAuthToken;

    if (String.IsNullOrEmpty(_oAuthToken) || String.IsNullOrEmpty(_oAuthTokenSecret))
    {
        Dispatcher.BeginInvoke(() => MessageBox.Show("error calling twitter"));
        return;
    }

    Dispatcher.BeginInvoke(() => browserControl.Navigate(new Uri(authorizeUrl)));
}

我收到的错误是NullReferenceException-> Hammock.WindowsPhone.dll!

Hammock.Silverlight.Compat.GzipHttpWebResponse.GetResponseStream() + 0x1c字节

在堆栈中,我得到的错误是

Hammock.Silverlight.Compat.GzipHttpWebResponse.GetResponseStream()的

在Hammock.Web.WebQuery.GetAsyncResponseCallback(IAsyncResult asyncResult)

在System.Net.Browser.ClientHttpWebRequest.<>c_DisplayClassa.b_8(Object state2)

在System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object州)

在System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback回调,对象状态)

在System.Threading.ThreadPool.WorkItem.doWork(Object o)

在System.Threading.Timer.ring()

有什么问题吗?

EN

回答 1

Stack Overflow用户

发布于 2012-05-23 13:48:58

有引用问题,这是导致问题的原因,已经解决了,谢谢你的支持,乔恩。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10700413

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档