0

I've created a simple web app with SignalR Core and deployed it into Azure, and enabled websockets for app service.

But after that when I try to access it using https:// it returns HTTP ERROR 500.

Any idea what is wrong? Do I need to set anything else in settings to make it work over https?

Tom Sun - MSFT
  • 24,161
  • 3
  • 30
  • 47
  • ``Do I need to set anything else in settings to make it work over https?`` does it work over http? – Fei Han Apr 13 '17 at 09:08

1 Answers1

0

when I try to access it using https:// it returns HTTP ERROR 500.

Please make sure your SignalR app could run without any error before publishing it to Azure website. I have a sample app that works fine on local and Azure, please refer to it.

Project.json

{
  "dependencies": {
    "Gray.Microsoft.AspNetCore.SignalR.Server": "0.2.0-alpha1",
    "Microsoft.AspNetCore.WebSockets": "1.0.1",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.1.1",
    "Microsoft.Extensions.Logging.Console": "1.1.1",
    "Microsoft.Extensions.Logging.Debug": "1.1.1",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.AspNet.SignalR.Client": "2.2.1"
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Startup class

public void ConfigureServices(IServiceCollection services)
{
    // Add framework services.
    services.AddMvc();
    services.AddSignalR(options=> {
        options.Hubs.EnableDetailedErrors = true;
    });
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    loggerFactory.AddConsole(Configuration.GetSection("Logging"));
    loggerFactory.AddDebug();

    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
        app.UseBrowserLink();
    }
    else
    {
        app.UseExceptionHandler("/Home/Error");
    }

    app.UseStaticFiles();
    app.UseWebSockets();
    app.UseSignalR();

    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}");
    });
}

Website Chat page

enter image description here

Besides, this article is about “Getting started with SignalR Core”, please refer to it.

Fei Han
  • 26,415
  • 1
  • 30
  • 41
  • Thank you for the answer. It works locally and it was working in Azure before I switched websockets on in Azure. Probably I need to play around more to get more details. – KonstantinF Apr 13 '17 at 11:07
  • ``It works locally and it was working in Azure before I switched websockets on in Azure`` Please try to publish your application to a new Azure web site and test if it works. – Fei Han Apr 14 '17 at 08:29
  • Thanks, it's my fault, there were few unresolved errors – KonstantinF Apr 18 '17 at 10:09