我收到一条错误消息:“安全错误。”在调用以下代码时:
_hubConnection.Start(new LongPollingTransport()).ContinueWith(task =>
{
if (task.IsFaulted)
{
throw new Exception(task.Exception.GetBaseException().Message);
}
}
堆栈追踪:
在System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
在Microsoft.AspNet.SignalR.Client.Http.HttpHelper。<> c_ DisplayClass2.b _0(IAsyncResult ar)
在System.Threading.Tasks.TaskFactory 1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction,Action 1 endAction, Task
1 promise)
跨域XML:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
</cross-domain-policy>
客户访问政策:
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-methods="*" http-request-headers="*">
<domain uri="http://*"/>
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
还尝试提供凭据,但结果相同。
知道什么可能导致这个问题吗?
答案 0 :(得分:1)
在github.com/SignalR/SignalR/blob/dev/samples /下有一个Silverlight示例。试试吧,也可以使用Fiddler来确保SL客户端找到你的clientaccesspolicy.xml