简体   繁体   English

/ signalr / hubs 404(未找到)在DNN 7.3.4中

[英]/signalr/hubs 404 (Not Found) in DNN 7.3.4

I am developing a website using DNN 7.3.4. 我正在使用DNN 7.3.4开发一个网站。 I am signalr in this. 我是这个信号。 I have executed this script for AUM_DoNotRewriteRegEx . 我已经为AUM_DoNotRewriteRegEx执行了此脚本。

IF NOT EXISTS (SELECT * FROM dnn_hostsettings WHERE SettingName = 'AUM_DoNotRewriteRegEx' )

      insert into dnn_hostsettings
        (SettingName
        , SettingValue
        , SettingIsSecure 
        , CreatedByUserId
        , CreatedOnDate
        , LastModifiedByUserId
        , LastModifiedOnDate
        )
        values(
        'AUM_DoNotRewriteRegEx'
        ,'/DesktopModules/|/Providers|/LinkClick\.aspx|/SignalR'
        , 0
        , -1
        , GETDATE()
        , -1
        , GETDATE()
        )

    GO

    IF EXISTS (SELECT * FROM dnn_hostsettings WHERE SettingName = 'AUM_DoNotRewriteRegEx' and SettingValue not like '%/signalr%' )

    update dnn_hostsettings
        set settingValue = (select settingValue + '|/signalr' from dnn_hostsettings where settingname = 'AUM_DoNotRewriteRegEx')
    where settingname = 'AUM_DoNotRewriteRegEx'

    GO

And in my page 在我的页面

<script type="text/javascript" src='<%=ResolveClientUrl("~/signalr/hubs") %>'></script>

var objHub = $.connection.myHub;
$.connection.hub.start().done(function () {
    //....
})

But it's not working every time it's showing this. 但是,每次显示此内容时它都无法正常工作。 在此处输入图片说明

I think you are missing the OwinStartup class that starts the signalR hub in your application. 我认为您缺少在应用程序中启动signalR集线器的OwinStartup类。 Look at this project on my github called DnnLogAnalyzer . 在我的github上查看这个名为DnnLogAnalyzer的项目。 I have a class called Startup.cs that hooks into the OwinStartup and starts the signalR hub for the application. 我有一个名为Startup.cs的类,该类可以挂接到OwinStartup并启动该应用程序的signalR集线器。

using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(DotNetNuclear.Modules.LogAnalyzer.Components.Startup))]

namespace DotNetNuclear.Modules.LogAnalyzer.Components
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ...
            app.MapSignalR();
        } 
    }
}

If you are a DNNHero.com subscriber, you can also check out my step-by-step tutorial for tips on getting SignalR working in your DNN application . 如果您是DNNHero.com的订户,还可以查看我的分步教程,以获取有关使SignalR在DNN应用程序中运行的提示。

After huge R&D I found this 经过大量的研发,我发现了这个

My owin startup class was not starting. 我的owin startup class未启动。 I already have these keys in web config for automatically start owin 我已经在网络配置中拥有了这些键,可以自动启动owin

<add key="owin:AutomaticAppStartup" value="true" />
<add key="owin:appStartup" value="MyNamespace.MyStartupClass" />

But owin startup class was not starting after doing this. 但是执行此操作后, owin startup class未启动。

Then I found Microsoft.Owin.Host.SystemWeb is responsible for starting owin startup class . 然后我发现Microsoft.Owin.Host.SystemWeb负责启动owin startup class And I missed to add this dll in my project. 我错过了在我的项目中添加此dll After adding Microsoft.Owin.Host.SystemWeb owin started and register hub routes successfully. 添加Microsoft.Owin.Host.SystemWeb owin启动并成功注册集线器路由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM