通过运行DotNetOpenAuth示例获取ProtocolException

时间:2011-04-05 11:57:37

标签: c# wpf oauth dotnetopenauth

我已经下载了DotNetOpenAuth-3.4.6.10357构建它(由于构建错误而不得不排除OpenIdOfflineProvider)并运行OAuthConsumerWpf。点击Authorize后,我得到了以下例外情况。请记住我按照指示修改了app.config。这来自Google标签。我还尝试了Generic标签,结果相同。

这里有什么问题?不应该像开箱即用的那样简单吗?

DotNetOpenAuth.Messaging.ProtocolException was unhandled
    Message=Error occurred while sending a direct message or getting the response.
    Source=DotNetOpenAuth
    StackTrace:
        at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\StandardWebRequestHandler.cs:line 172
        at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\StandardWebRequestHandler.cs:line 100
        at DotNetOpenAuth.Messaging.Channel.GetDirectResponse(HttpWebRequest webRequest) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\Channel.cs:line 607
        at DotNetOpenAuth.Messaging.Channel.RequestCore(IDirectedProtocolMessage request) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\Channel.cs:line 628
        at DotNetOpenAuth.Messaging.Channel.Request(IDirectedProtocolMessage requestMessage) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\Channel.cs:line 451
        at DotNetOpenAuth.Messaging.Channel.Request[TResponse](IDirectedProtocolMessage requestMessage) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\Channel.cs:line 431
        at DotNetOpenAuth.OAuth.ConsumerBase.PrepareRequestUserAuthorization(Uri callback, IDictionary`2 requestParameters, IDictionary`2 redirectParameters, String& requestToken) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\OAuth\ConsumerBase.cs:line 222
        at DotNetOpenAuth.OAuth.DesktopConsumer.RequestUserAuthorization(IDictionary`2 requestParameters, IDictionary`2 redirectParameters, String& requestToken) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\OAuth\DesktopConsumer.cs:line 42
        at DotNetOpenAuth.ApplicationBlock.GoogleConsumer.RequestAuthorization(DesktopConsumer consumer, Applications requestedAccessScope, String& requestToken) in C:\Users\user\Desktop\DotNetOpenAuth-3.4.6.10357\Samples\DotNetOpenAuth.ApplicationBlock\GoogleConsumer.cs:line 204
        at DotNetOpenAuth.Samples.OAuthConsumerWpf.MainWindow.<beginAuthorizationButton_Click>b__3(DesktopConsumer consumer, String& requestToken) in C:\Users\user\Desktop\DotNetOpenAuth-3.4.6.10357\Samples\OAuthConsumerWpf\MainWindow.xaml.cs:line 92
        at DotNetOpenAuth.Samples.OAuthConsumerWpf.Authorize.<>c__DisplayClass4.<.ctor>b__0(Object state) in C:\Users\user\Desktop\DotNetOpenAuth-3.4.6.10357\Samples\OAuthConsumerWpf\Authorize.xaml.cs:line 33
        at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
        at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
        at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
        at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
    InnerException: System.Net.WebException
        Message=The remote server returned an error: (400) Bad Request.
        Source=System
        StackTrace:
            at System.Net.HttpWebRequest.GetResponse()
            at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options) in c:\Users\andarno\git\dotnetopenid\src\DotNetOpenAuth\Messaging\StandardWebRequestHandler.cs:line 126
        InnerException: 

1 个答案:

答案 0 :(得分:1)

适合我。也许您的计算机位于防火墙后面或需要注册代理服务器?