Silverlight SecurityException

Gra*_*eme 5 securityexception silverlight-4.0

我正在将数据发布到服务器并成功执行BeginGetRequestStream,然后是EndGetRequestStream,将我的POST数据写入填充RequestStream,并调用BeginGetResponse.

BeginGetResponse成功返回,然后我调用:

Dim response As HttpWebResponse = CType(MyHttpRequest.EndGetResponse(asynchronousResult), HttpWebResponse)
Run Code Online (Sandbox Code Playgroud)

此行抛出以下SecurityException错误:

{System.Security.SecurityException ---> System.Security.SecurityException:安全错误.
System.Net上的System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
,System.Net.Browser.AsyncHelper上的<> c__DisplayClass5.b__4(Object sendState)
.<> c__DisplayClass2.b__0(Object sendState)

---内部异常堆栈跟踪的结尾---
在System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,对象状态)
在System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult的asyncResult)
在EtsyV2NetSL.WebQuery.POST_ResponseCallback( IAsyncResult asynchronousResult)}

所以我的第一个想法是我被服务器用clientaccesspolicy.xml或crossdomain.xml阻止.我已经解雇了Fiddler并看到了以下内容:

GET http://openapi.etsy.com/clientaccesspolicy.xml > 596 (text/xml)
GET http://openapi.etsy.com/crossdomain.xml > 200 OK (application/xml)
Run Code Online (Sandbox Code Playgroud)

所以我检查了他们的crossdomain.xml,设置显示正常:

<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
   <allow-access-from domain="*"/>
</cross-domain-policy>
Run Code Online (Sandbox Code Playgroud)

我试图解决这个问题已经走到了尽头.我在VS的开发机器上运行测试应用程序.

有没有人有任何想法为什么Silverlight会抛出这个错误?

谢谢

Jpo*_*las 1

看来是客户端访问策略问题,检查一下:

http://forums.silverlight.net/forums/p/26566/90867.aspx

这对我有用。