AzureSignalR-samples icon indicating copy to clipboard operation
AzureSignalR-samples copied to clipboard

Azure sample gives error when calling $.connection.hub.start()

Open MrYossu opened this issue 5 years ago • 1 comments

I followed the local chat room sample, and it worked fine.

I then tried modifying it to use Azure, as shown in the Azure chat room sample.

My changes were to modify Startup.cs to call app.MapAzureSignalR(GetType().FullName) instead of app.MapSignalR() and to add the connection string to my web.config file (see below).

However, this does not work. When I load the page and enter my name, I see the following error in the browser's console window...

app.MapSignalR()Uncaught TypeError: Cannot read property 'toLowerCase' of undefined at hubConnection.fn.init. (jquery.signalR-2.4.0.js:2997) at hubConnection.fn.init. (jquery.signalR-2.4.0.js:877) at hubConnection.fn.init.handle (jquery-1.6.4.min.js:3) at hubConnection.fn.init.k (jquery-1.6.4.min.js:2) at Object.trigger (jquery-1.6.4.min.js:3) at init.triggerHandler (jquery-1.6.4.min.js:3) at Object.triggerReceived (jquery.signalR-2.4.0.js:1599) at Object. (jquery.signalR-2.4.0.js:1634) at Function.each (jquery-1.6.4.min.js:2) at Object.processMessages (jquery.signalR-2.4.0.js:1633)

This seems to happen in the call to $.connection.hub.start()

Anyone any ideas what's gone wrong? My full web.config (with sensitive data removed) is shown below...

<?xml version="1.0"
      encoding="utf-8"?>

<configuration>
  <connectionStrings>
    <add name="Azure:SignalR:ConnectionString"
         connectionString="Endpoint=https://something.service.signalr.net;AccessKey=MyAccessKey=;Version=1.0;" />
  </connectionStrings>

  <system.web>
    <compilation debug="true"
                 targetFramework="4.6.1" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json"
                          publicKeyToken="30ad4fe6b2a6aeed"
                          culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0"
                         newVersion="11.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Buffers"
                          publicKeyToken="cc7b13ffcd2ddd51"
                          culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0"
                         newVersion="4.0.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Threading.Tasks.Extensions"
                          publicKeyToken="cc7b13ffcd2ddd51"
                          culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.0.0"
                         newVersion="4.2.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.ValueTuple"
                          publicKeyToken="cc7b13ffcd2ddd51"
                          culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.2.0"
                         newVersion="4.0.2.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp"
                extension=".cs"
                type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                warningLevel="4"
                compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript"
                extension=".vb"
                type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                warningLevel="4"
                compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
</configuration>

MrYossu avatar Jan 23 '19 18:01 MrYossu

Could you add more logs to app server side to see what went wrong?

  1. when you are debugging locally, you can try: https://github.com/Azure/azure-signalr/blob/dev/docs/tsg.md#troubleshooting-guide-1

  2. or you can follow https://github.com/Azure/azure-signalr/blob/dev/docs/tsg.md#enable-server-side-traces-for-aspnet-signalr

vicancy avatar Jun 24 '19 06:06 vicancy