1
votes

When I run my server side Blazor app on development machine in Visual Studio code everything works fine. But after deployment to a Linux server with Apache2 there is a problem with WSS:// SignalR connection from client to server.

Running Root page of https://shop.gastroblitz.de/ results in Console Error:

Firefox kann keine Verbindung zu dem Server unter wss://shop.gastroblitz.de/_blazor?id=P1LOmrVSgCD4fAWd9lAhHQ aufbauen. blazor.server.js:1:30021 [2019-07-17T14:58:20.948Z] Error: Failed to start the transport 'WebSockets': null

I have reverse proxy configuration that redirects - https:// calls in server to http://localhost:5000 (where dotnet service is hosted) - wss:// calls into ws://

seems to work fine on https:// but I don't get work the SignalR thing which is initiated with wss:// and results in the upper error...

Using Visual Studio newest preview and dotnetcore-preview6.

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;

        SqlHub.ConnectionString = Configuration["ConnectionString"];
    }

    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddServerSideBlazor();
        services.AddScoped<OrderState>();
        services.AddScoped<StoreData>();
        services.AddScoped<BasketManager>();
        services.AddBlazoredModal();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
            app.UseHsts();
        }

        //app.UseHttpsRedirection();
        app.UseStaticFiles();

        app.UseRouting();

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapBlazorHub();
            endpoints.MapFallbackToPage("/_Host");
        });
    }

I want to have the whole Blazor app on the server like it is running in my Visual Studio environment. Would be great if someone has an useful hint regarding SSL / wss and all the configuration stuff... thx!

1
here Console result of application ibb.co/DMmk8xPbaer999
On Azure you have to turn on WebSockets. I suggest you look for a similar setting in Apache.Henk Holterman

1 Answers

0
votes

You need to enable websockets on your server for this to work.