Skip to content

Commit 3945af4

Browse files
committed
Detect SqlException reporting unsupported feature when attempting to start SqlDependency.
1 parent 4f82af4 commit 3945af4

File tree

1 file changed

+10
-0
lines changed
  • src/IntelliTect.AspNetCore.SignalR.SqlServer/Internal/SqlServer

1 file changed

+10
-0
lines changed

src/IntelliTect.AspNetCore.SignalR.SqlServer/Internal/SqlServer/SqlReceiver.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,16 @@ private bool StartSqlDependencyListener()
363363
_notificationsDisabled = true;
364364
return false;
365365
}
366+
catch (SqlException ex) when (ex.Number == 40510 || ex.Message.Contains("not supported"))
367+
{
368+
// Workaround for https://github.com/dotnet/SqlClient/issues/1264.
369+
// Specifically that Azure SQL Database reports that service broker is enabled,
370+
// even though it is entirely unsupported.
371+
372+
_logger.LogInformation("{0}SQL Service Broker is unsupported by the target database. Falling back on periodic polling.", _tracePrefix);
373+
_notificationsDisabled = true;
374+
return false;
375+
}
366376
catch (Exception ex)
367377
{
368378
_logger.LogError(ex, "{0}Error starting SQL notification listener", _tracePrefix);

0 commit comments

Comments
 (0)