1

I am developing a website using DNN 7.3.4. I am signalr in this. I have executed this script for 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. enter image description here

Manoj
  • 4,951
  • 2
  • 30
  • 56

2 Answers2

2

I think you are missing the OwinStartup class that starts the signalR hub in your application. Look at this project on my github called DnnLogAnalyzer. I have a class called Startup.cs that hooks into the OwinStartup and starts the signalR hub for the application.

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.

Fix It Scotty
  • 2,852
  • 11
  • 12
  • I have already added startup class and in web config i have these keys for automatic owin startup ` ` – Manoj Jul 04 '17 at 04:49
2

After huge R&D I found this

My owin startup class was not starting. I already have these keys in web config for automatically start owin

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

But owin startup class was not starting after doing this.

Then I found Microsoft.Owin.Host.SystemWeb is responsible for starting owin startup class. And I missed to add this dll in my project. After adding Microsoft.Owin.Host.SystemWeb owin started and register hub routes successfully.

Manoj
  • 4,951
  • 2
  • 30
  • 56