<bdo id='mFtI0'></bdo><ul id='mFtI0'></ul>

      <i id='mFtI0'><tr id='mFtI0'><dt id='mFtI0'><q id='mFtI0'><span id='mFtI0'><b id='mFtI0'><form id='mFtI0'><ins id='mFtI0'></ins><ul id='mFtI0'></ul><sub id='mFtI0'></sub></form><legend id='mFtI0'></legend><bdo id='mFtI0'><pre id='mFtI0'><center id='mFtI0'></center></pre></bdo></b><th id='mFtI0'></th></span></q></dt></tr></i><div id='mFtI0'><tfoot id='mFtI0'></tfoot><dl id='mFtI0'><fieldset id='mFtI0'></fieldset></dl></div>
    1. <small id='mFtI0'></small><noframes id='mFtI0'>

      <legend id='mFtI0'><style id='mFtI0'><dir id='mFtI0'><q id='mFtI0'></q></dir></style></legend>

      <tfoot id='mFtI0'></tfoot>

      如何使用 SignalR 使用跨域连接(CORS - 访问控制允许来源)

      How to use cross-domain connections (CORS - Access Control Allow Origin) with SignalR(如何使用 SignalR 使用跨域连接(CORS - 访问控制允许来源))
      <tfoot id='y156G'></tfoot>

      <small id='y156G'></small><noframes id='y156G'>

        <i id='y156G'><tr id='y156G'><dt id='y156G'><q id='y156G'><span id='y156G'><b id='y156G'><form id='y156G'><ins id='y156G'></ins><ul id='y156G'></ul><sub id='y156G'></sub></form><legend id='y156G'></legend><bdo id='y156G'><pre id='y156G'><center id='y156G'></center></pre></bdo></b><th id='y156G'></th></span></q></dt></tr></i><div id='y156G'><tfoot id='y156G'></tfoot><dl id='y156G'><fieldset id='y156G'></fieldset></dl></div>
          <tbody id='y156G'></tbody>
          • <bdo id='y156G'></bdo><ul id='y156G'></ul>

            1. <legend id='y156G'><style id='y156G'><dir id='y156G'><q id='y156G'></q></dir></style></legend>

              • 本文介绍了如何使用 SignalR 使用跨域连接(CORS - 访问控制允许来源)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                使用持久连接和 ASP.NET JavaScript 客户端,我尝试连接到与提供页面的子域不同的子域.

                Using persistent connections and an ASP.NET JavaScript client, I am trying to connect to a sub-domain not the same as the one the page was served from.

                ASP.Net 页面想要连接到位于 sub2.mydomain.com 的 SignalR.在同一子域中连接时,相同的代码可以正常工作.

                ASP.Net Page from webserver sub1.mydomain.com wants to connect to SignalR at sub2.mydomain.com. The same code works fine when connecting within the same sub-domain.

                我发现另一个帖子启用了跨域连接:

                I found another post where cross-domain connections were enabled with:

                jQuery.support.cors = true;
                

                但这对我不起作用.

                如何使用持久连接和 JavaScript 客户端连接到第二个子域中的 SignalR?

                How can I connect to SignalR in a second sub-domain using persistent connection and a JavaScript client?

                推荐答案

                您需要执行以下操作之一才能使其工作:

                You need to do one of the following to make it work:

                • 设置 $.connection.hub.url = 'http://subdomain.domain.com/signalr';,指向您的子域.
                • 在服务器上启用跨域:

                • Set up $.connection.hub.url = 'http://subdomain.domain.com/signalr';, pointing to your subdomain.
                • Enable cross domain on the server:

                RouteTable.Routes.MapHubs(new HubConfiguration()
                {
                  EnableCrossDomain = true
                });
                

                这篇关于如何使用 SignalR 使用跨域连接(CORS - 访问控制允许来源)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Using entity Framework with .NET Core and DB2(将实体框架与 .NET Core 和 DB2 结合使用)
                SQL1159 Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.3(SQL1159 DB2 .NET 数据提供程序的初始化错误,原因代码 10,令牌 0.0.0、9.7.3)
                Geolocation error with IP address 127.0.0.1(IP 地址为 127.0.0.1 的地理定位错误)
                Geolocation web service recommendations(地理位置 Web 服务建议)
                Finding clients location in an ASP.NET page(在 ASP.NET 页面中查找客户端位置)
                Fetch Latitude Longitude by passing postcodes to maps.google.com using Javascript(通过使用 Javascript 将邮政编码传递给 maps.google.com 来获取纬度经度)

                <small id='N6SK5'></small><noframes id='N6SK5'>

                <tfoot id='N6SK5'></tfoot>
                  <tbody id='N6SK5'></tbody>

                  • <i id='N6SK5'><tr id='N6SK5'><dt id='N6SK5'><q id='N6SK5'><span id='N6SK5'><b id='N6SK5'><form id='N6SK5'><ins id='N6SK5'></ins><ul id='N6SK5'></ul><sub id='N6SK5'></sub></form><legend id='N6SK5'></legend><bdo id='N6SK5'><pre id='N6SK5'><center id='N6SK5'></center></pre></bdo></b><th id='N6SK5'></th></span></q></dt></tr></i><div id='N6SK5'><tfoot id='N6SK5'></tfoot><dl id='N6SK5'><fieldset id='N6SK5'></fieldset></dl></div>
                  • <legend id='N6SK5'><style id='N6SK5'><dir id='N6SK5'><q id='N6SK5'></q></dir></style></legend>

                      • <bdo id='N6SK5'></bdo><ul id='N6SK5'></ul>