Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions docs/core/compatibility/6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff

## ASP.NET Core

| Title | Preview introduced |
| Title | Introduced |
| - | - |
| [AddDataAnnotationsValidation method made obsolete](aspnet-core/6.0/adddataannotationsvalidation-obsolete.md) | |
| [Assemblies removed from Microsoft.AspNetCore.App shared framework](aspnet-core/6.0/assemblies-removed-from-shared-framework.md) | |
| [Blazor: Parameter name changed in RequestImageFileAsync method](aspnet-core/6.0/blazor-parameter-name-changed-in-method.md) | Preview 1 |
| [Blazor: WebEventDescriptor.EventArgsType property replaced](aspnet-core/6.0/blazor-eventargstype-property-replaced.md) | |
| [Blazor: Byte array interop](aspnet-core/6.0/byte-array-interop.md) | Preview 6 |
| [Blazor server: Disable long polling fallback transport](aspnet-core/6.0/blazor-long-polling-fallback.md) | RC 1 |
| [Changed MessagePack library in @microsoft/signalr-protocol-msgpack](aspnet-core/6.0/messagepack-library-change.md) | |
| [ClientCertificate property doesn't trigger renegotiation for HttpSys](aspnet-core/6.0/clientcertificate-doesnt-trigger-renegotiation.md) | |
| [Kestrel: Log message attributes changed](aspnet-core/6.0/kestrel-log-message-attributes-changed.md) | |
Expand All @@ -37,7 +38,7 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff

## Core .NET libraries

| Title | Preview introduced |
| Title | Introduced |
| - | - |
| [API obsoletions with non-default diagnostic IDs](core-libraries/6.0/obsolete-apis-with-custom-diagnostics.md) | Preview 1 |
| [Changes to nullable reference type annotations](core-libraries/6.0/nullable-ref-type-annotation-changes.md) | Preview 1-2 |
Expand All @@ -54,25 +55,25 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff

## Globalization

| Title | Preview introduced |
| Title | Introduced |
| - | - |
| [Culture creation and case mapping in globalization-invariant mode](globalization/6.0/culture-creation-invariant-mode.md) | Preview 7 |

## JIT compiler

| Title | Preview introduced |
| Title | Introduced |
| - | - |
| [Coerce call arguments according to ECMA-335](jit/6.0/coerce-call-arguments-ecma-335.md) | Preview 1 |

## Networking

| Title | Preview introduced |
| Title | Introduced |
| - | - |
| [WebRequest, WebClient, and ServicePoint are obsolete](networking/6.0/webrequest-deprecated.md) | Preview 1 |

## SDK

| Title | Preview introduced |
| Title | Introduced |
| - | - |
| [`-p` option for `dotnet run` is deprecated](sdk/6.0/deprecate-p-option-dotnet-run.md) | Preview 6 |
| [C# code in templates not supported by earlier versions](sdk/6.0/csharp-template-code.md) | Preview 7 |
Expand All @@ -83,7 +84,7 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff

## Windows Forms

| Title | Preview introduced |
| Title | Introduced |
| - | - |
| [Selected TableLayoutSettings properties throw InvalidEnumArgumentException](windows-forms/6.0/tablelayoutsettings-apis-throw-invalidenumargumentexception.md) | Preview 1 |
| [DataGridView-related APIs now throw InvalidOperationException](windows-forms/6.0/null-owner-causes-invalidoperationexception.md) | Preview 4 |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: "Breaking change: Blazor server: Disable LongPolling fallback transport"
description: "Learn about the breaking change in ASP.NET Core 6.0 where LongPolling is not used as a fallback transport when WebSockets aren't available."
ms.date: 08/12/2021
no-loc: [ Blazor, WebSocket, LongPolling ]
---
# Blazor server: Disable long polling fallback transport

Prior to .NET 6, *LongPolling* was a fallback transport utilized when WebSockets weren't available. The LongPolling fallback can lead to a degraded user experience, so it has been removed. Both the client and server now support only WebSockets by default.

## Version introduced

ASP.NET Core 6.0 RC 1

## Old behavior

If WebSockets are unavailable for a circuit (for example, due to network issues or browser incompatibility), LongPolling is used instead.

## New behavior

The following table shows the error message you'll receive for each combination of client and server configurations.

| Client | Server | Message |
|---|---|---|
| WS (without browser WS support) | WebSockets | `Unable to connect, please ensure you are using an updated browser that supports WebSockets.` |
| WS (with WS connection being rejected) | WebSockets | `Unable to connect, please ensure WebSockets are available. A VPN or proxy may be blocking the connection.` |
| WS | LongPolling | `An unhandled error has occurred.` Console Error: `Unable to initiate a SignalR connection to the server. This might be because the server is not configured to support WebSockets. To troubleshoot this, visit https://aka.ms/blazor-server-websockets-error.` |
| LongPolling | WebSockets | `An unhandled error has occurred.` |

## Reason for change

This change was made to improve the overall end-user experience by enforcing WebSocket use.

## Recommended action

Ensure WebSockets are functioning as expected with your application. If you must use LongPolling, you can enable it by making the following client and server side changes.

### Server side

In `Startup.cs`, replace `endpoints.MapBlazorHub()` with:

```c#
endpoints.MapBlazorHub(configureOptions: options =>
{
options.Transports = HttpTransportType.WebSockets | HttpTransportType.LongPolling;
});
```

### Client side

Add the following script to `_Layout.cshtml` before the closing `</body>` tag. The supported <xref:Microsoft.AspNetCore.Http.Connections.HttpTransportType> fields are <xref:Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets?displayProperty=nameWithType> (`1`) and <xref:Microsoft.AspNetCore.Http.Connections.HttpTransportType.LongPolling?displayProperty=nameWithType> (`4`).

```html
<script>
(function start() {
Blazor.start({
configureSignalR: builder => builder.withUrl('_blazor', 1 | 4) // WebSockets and LongPolling
});
})()
</script>
```

## Affected APIs

None.
4 changes: 4 additions & 0 deletions docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ items:
href: aspnet-core/6.0/blazor-eventargstype-property-replaced.md
- name: "Blazor: Byte-array interop"
href: aspnet-core/6.0/byte-array-interop.md
- name: "Blazor server: Disable long-polling fallback"
href: aspnet-core/6.0/blazor-long-polling-fallback.md
- name: ClientCertificate doesn't trigger renegotiation
href: aspnet-core/6.0/clientcertificate-doesnt-trigger-renegotiation.md
- name: "Kestrel: Log message attributes changed"
Expand Down Expand Up @@ -413,6 +415,8 @@ items:
href: aspnet-core/6.0/blazor-eventargstype-property-replaced.md
- name: "Blazor: Byte-array interop"
href: aspnet-core/6.0/byte-array-interop.md
- name: "Blazor server: Disable long-polling fallback"
href: aspnet-core/6.0/blazor-long-polling-fallback.md
- name: ClientCertificate doesn't trigger renegotiation
href: aspnet-core/6.0/clientcertificate-doesnt-trigger-renegotiation.md
- name: "Kestrel: Log message attributes changed"
Expand Down