简体   繁体   English

如果回调URL包含IP地址,则为TweetSharp异常

[英]TweetSharp exception if callback url contains IP Address

I may have stumbled onto a strange bug thats within either TweetSharp or Hammock. 我可能偶然发现了TweetSharp或Hammock中的一个奇怪的bug。 When trying to get an authorization token from Twitter via the normal routine of: 当试图通过以下常规例程从Twitter获取授权令牌时:

TwitterService service = new TwitterService(API_KEY,API_SECRET);
OAuthRequestToken request = service.GetRequestToken(GetCallBackUrl());

I've noticed that if the callback url contains an IP address instead of a machine name (localhost/SERVER1 etc), the page takes forever to load then an ArgumentNullException is thrown. 我注意到如果回调url包含IP地址而不是机器名(localhost / SERVER1等),页面将永远加载,然后抛出ArgumentNullException。

System.ArgumentNullException: Value cannot be null. 
Parameter name: query at System.Compat.Web.HttpUtility.ParseQueryString(String query, Encoding encoding) 

in f:\src\hammock\src\net40\Hammock.ClientProfile\Mono\HttpUtility.cs:line 1220 at 
System.Compat.Web.HttpUtility.ParseQueryString(String query) 
in f:\src\hammock\src\net40\Hammock.ClientProfile\Mono\HttpUtility.cs:line 1214 
at TweetSharp.TwitterService.GetRequestToken(String callback) 
in f:\src\tweetsharp\src\TweetSharp\TwitterService.OAuth.cs:line 173 
at TwitterForm.SetAuthUrl() 
at TwitterForm.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) 
at System.Web.UI.Control.LoadRecursive() 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Once I switch back to the PC name, all seems fine, sometimes. 一旦我切换回PC名称,有时候一切似乎都很好。 On most clients, switching to the Name works, on some however, it doesnt and keeps throwing the above error. 在大多数客户端,切换到名称工作,但在某些情况下,它不会并且不断抛出上述错误。 I suspect the people for whom changing to the PC name doesn't work, may be the fact that they're using a proxy server. 我怀疑改为PC名称的人不起作用,可能是因为他们正在使用代理服务器。 I'll keep troubleshooting. 我会继续排除故障。

For now I just wanted to know if anyone has a possible work-around or solution to this? 现在我只是想知道是否有人可以解决这个问题?

In the end this bug turned out not to be caused by the IP Address but because of issues related to proxy server authentication. 最后,这个bug不是由IP地址引起的,而是由于与代理服务器身份验证相关的问题。 The account we were using to access the proxy server had a password that kept expiring, switching to an account with a fixed password resolved it. 我们用来访问代理服务器的帐户有一个密码保持过期,切换到一个具有固定密码的帐户解决了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM