当我遇到这个例外时,我正试图从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();
这是一个错误还是我做错了什么?