【问题标题】:How to deploy simple SignalR in IIS?如何在 IIS 中部署简单的 SignalR?
【发布时间】:2021-02-23 02:07:39
【问题描述】:

我遵循了本教程 (https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr)。它在 Visual-Studio-2017 中运行良好。我对 web 和 signalR(以及 stackoverflow)完全陌生,不知道如何在 IIS 中部署它。

当我从 ..\SignalRChat\SignalRChat\ 文件夹启动 index.html 文件时,我收到了这个神秘的错误:

Failed to load resource: net::ERR_FILE_NOT_FOUND
index.html:34 Uncaught TypeError: Cannot read property 'client' of undefined
    at HTMLDocument.<anonymous> (index.html:34)
    at c (jquery-1.10.2.min.js:21)
    at Object.fireWith [as resolveWith] (jquery-1.10.2.min.js:21)
    at Function.ready (jquery-1.10.2.min.js:21)
    at HTMLDocument.q (jquery-1.10.2.min.js:21)

顺便说一句:虽然我发现了其他类似的问题,但都没有帮助!

【问题讨论】:

    标签: iis signalr web-deployment


    【解决方案1】:

    经过多次狩猎和啄食,我们放弃了上面提到的 MS 示例。相反,我们使用了 https://www.codeproject.com/Articles/5162436/Simple-SignalR-Server-and-Client-Applications-Demo 中的代码,它使用了 SignalR 的自托管选项。 (一篇写得很好的文章,包含三个项目:JavascriptClient、WinFormsClient 和 WinFormsServer。)

    使用 example.com 作为域名,使用 x:\example\ 作为站点由 AWS 或 Azure 等 VPS 提供商托管的文件夹,这就是我们所做的。

    1. 在文件系统中创建了两个文件夹:x:\example\chat\ 和 x:\example\msg\
    2. 在 IIS 中创建了两个子域网站 chat.example.com 和 msg.example.com
    3. 在域托管服务中,进行了调整,使两者都“可见”(我们花了大约 36 小时才能通过我们的某些桌面上的浏览器访问它们)
    4. 在 x:\example\chat\ 中安装了 JavascriptClient 文件(其中有一个 index.htm 文件)
    5. 创建了 x:\example\WinFormsServer 文件夹并将其文件安装在其中
    6. 在 IIS 中确保 chat.example.com 已启动
    7. 在 IIS 中确保 msg.example.com 已停止

    一旦所有这些网站都“可见”

    现在 WinForms 客户端和 Javascript(又名 Web)客户端可以愉快地聊天了!并且 SignalR 不会干扰主站点上的页面,即http://example.com

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-23
      • 1970-01-01
      • 2019-02-13
      • 1970-01-01
      • 2019-06-03
      • 1970-01-01
      • 2021-06-09
      • 2020-04-20
      相关资源
      最近更新 更多