SuperSocket Silverlight策略服务器未被命中,策略未下载

时间:2014-10-21 21:52:24

标签: c# silverlight owin supersocket.net

我使用SuperSocket套接字服务(SuperSocket.SocketService.exe)作为我的Silverlight策略服务器,但服务未被命中且我的策略未返回。我可以通过Hercules连接到服务。

我已按照here所述,将内置的Flash Silverlight策略服务器添加到我的配置文件中,从而启用了该功能。 SuperSocket.Facility.dll存在于我服务的运行目录中,还有3个其他必需的dll。

服务配置文件:

<?xml version="1.0"?>
<configuration>
    <configSections>
        <section name="superSocket" type="SuperSocket.SocketEngine.Configuration.SocketServiceConfig, SuperSocket.SocketEngine" />
    </configSections>
    <appSettings>
        <add key="ServiceName" value="SupperSocketService" />
    </appSettings>
<superSocket>
    <servers>
        <server name="SilverlightPolicyServer"
                serverType="SuperSocket.Facility.PolicyServer.SilverlightPolicyServer, SuperSocket.Facility"
                ip="Any" port="943"
                receiveBufferSize="32"
                maxConnectionNumber="100"
                policyFile="D:\policyserver\SLPolicy.xml"
                clearIdleSession="true">
        </server>
    </servers>
</superSocket>
<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>

策略服务器启动正常:

enter image description here

来自Silverlight的连接失败

var webSocketClient = new WebSocket(string.Format("ws://127.0.0.1:{0}/websocket", 943, "basic", version));            
webSocketClient.Opened += new EventHandler(webSocketClient_Opened);
webSocketClient.Closed += new EventHandler(webSocketClient_Closed);
webSocketClient.DataReceived += new EventHandler<DataReceivedEventArgs>(webSocketClient_DataReceived);
webSocketClient.MessageReceived += new EventHandler<MessageReceivedEventArgs>(webSocketClient_MessageReceived);

if (autoConnect)
{
    webSocketClient.Open();

    if (!OpenedEvent.WaitOne(1000))
        throw new Exception("Cannot connect...");
 }

1 个答案:

答案 0 :(得分:0)

我从来没有解决问题并因各种原因中止了这个项目。

我用MEAN JS重写了它。