1

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!

2
  • here Console result of application ibb.co/DMmk8xP Commented Jul 17, 2019 at 16:19
  • 1
    On Azure you have to turn on WebSockets. I suggest you look for a similar setting in Apache. Commented Jul 17, 2019 at 17:16

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

1 Comment

Ok, but this is server side Blazor application - so no other server than this dll that runs the ports 5000 + 5001. External requests come through reverse proxy to it. How can I enable WebSockets in Server (Blazor App)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.