XSocket.Longpolling回归MVC 3

时间:2014-05-26 13:46:52

标签: xsockets.net

遇到这个问题。

MVC3,.NET 4.0,jQuery 1.11.0,XSockets 3.0

客户端:

IE8或Firefox(websocket = false)

<script src="jquery-1.11.0.min.js"></script>
<script src="jquery-migrate-1.2.1.min.js"></script>
<script src="json2.min.js"></script>
<script src="XSockets.fallback.latest.js"></script> 
<script src="XSockets.latest.js"></script>

$(function() {
        var conn = new XSockets.WebSocket("ws://127.0.0.1:4502/Generic");
        conn.onopen = function (connection) {
            // connection is open, subscribe to the 'foo' topic
            conn.on('foo', function (d) {
                //Data for the topic 'foo' arrived, add message to the page
                $('#content').append("<p>" + d + "</p>");
        });              
    };
});

服务器:

IIS Express,Windows身份验证

routes.MapRoute(
      "Fallback",
      "{controller}/{action}",
      new { controller = "Fallback", action = "Init" },
      new[] { "XSockets.Longpolling" }
 );

结果:

&#34; NetworkError:404 Not Found - localhost:63360 / Fallback / Init?url = ws%3A%2F%2F127.0.0.1%3A4502%2FGeneric%3FXSocketsClientStorageGuid%3D910d22f70cac4843832bd9f14ad9a549&amp; storageGuid =&amp; _ = 1401110430404& #34;

image

1 个答案:

答案 0 :(得分:0)

使用XSockets.NET longpolling后备版需要最低MVC4。

而且......从4.0开始,XSockets.NET将删除MVC的后备,并且仅支持.NET 4.5 WebAPI后备。 IIS8选项也将被删除,如果不是自托管XSockets.NET,将重点关注使用OWIN

编辑:错字