尝试使用 TweetSharp 读取公共时间线时出现 SecurityException
当我收到此异常时,我正在尝试使用 silverlight 项目中的 TweetSharp 库从公共时间线中读取内容。
Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Hammock.Web.WebQuery.GetAsyncResponseCallback(IAsyncResult asyncResult)
at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassd.<InvokeGetResponseCallback>b__b(Object state2)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Twitter 对 clientaccesspolicy.xml 文件抛出 404,但 crossdomain.xml 文件获取得很好。
发出请求的代码如下:
var tweets =
FluentTwitter.CreateRequest(new TweetSharp.TwitterClientInfo()).Statuses().OnPublicTimeline().AsJson().
CallbackTo((sndr, args, state) =>
{
var statuses = args.AsStatuses();
foreach (TwitterStatus status in statuses)
{
_statuses.Add(status);
}
});
tweets.BeginRequest();
这是一个错误还是我做错了什么?
I'm trying to read from the public timeline with the TweetSharp library from a silverlight project when I get this exception.
Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at Hammock.Web.WebQuery.GetAsyncResponseCallback(IAsyncResult asyncResult)
at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassd.<InvokeGetResponseCallback>b__b(Object state2)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Twitter throws a 404 for the clientaccesspolicy.xml file but the crossdomain.xml file is fetched just fine.
The code making the request is as follows:
var tweets =
FluentTwitter.CreateRequest(new TweetSharp.TwitterClientInfo()).Statuses().OnPublicTimeline().AsJson().
CallbackTo((sndr, args, state) =>
{
var statuses = args.AsStatuses();
foreach (TwitterStatus status in statuses)
{
_statuses.Add(status);
}
});
tweets.BeginRequest();
Is this a bug or am I doing something wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论