Intermittent “The underlying provider failed on Open” problem on Entity Framework: what’s going on?

I’ve some SQL Server db connection from an App Service in Azure (with dedicated vnet) that at some point (moment X) start to become weird and stops every following connection for 1 hour or so.

Here’s the complete Exception I got for every new connection I start after the moment X:

{
    "ClassName": "System.Data.Entity.Core.EntityException",
    "Message": "The underlying provider failed on Open.",
    "Data": null,
    "InnerException": {
        "Errors": [{
                "Source": ".Net SqlClient Data Provider",
                "Number": 5,
                "State": 0,
                "Class": 20,
                "Server": "",
                "Message": "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)",
                "Procedure": null,
                "LineNumber": 0
            }
        ],
        "ClientConnectionId": "00000000-0000-0000-0000-000000000000",
        "ClassName": "System.Data.SqlClient.SqlException",
        "Message": "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)",
        "Data": {
            "HelpLink.ProdName": "Microsoft SQL Server",
            "HelpLink.EvtSrc": "MSSQLServer",
            "HelpLink.EvtID": "5",
            "HelpLink.BaseHelpUrl": "http://go.microsoft.com/fwlink",
            "HelpLink.LinkId": "20476"
        },
        "InnerException": {
            "NativeErrorCode": 5,
            "ClassName": "System.ComponentModel.Win32Exception",
            "Message": "Access is denied",
            "Data": null,
            "InnerException": null,
            "HelpURL": null,
            "StackTraceString": null,
            "RemoteStackTraceString": null,
            "RemoteStackIndex": 0,
            "ExceptionMethod": null,
            "HResult": -2147467259,
            "Source": null,
            "WatsonBuckets": null
        },
        "HelpURL": null,
        "StackTraceString": "   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)rn   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)rn   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)rn   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)rn   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)rn   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)rn   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)rn   at System.Data.SqlClient.SqlConnection.Open()rn   at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<>c.<Open>b__13_0(DbConnection t, DbConnectionInterceptionContext c)rn   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)rn   at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)rn   at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__55_0()rn   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass2_0.<Execute>b__0()rn   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)rn   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation)rn   at System.Data.Entity.Core.EntityClient.EntityConnection.Open()",
        "RemoteStackTraceString": null,
        "RemoteStackIndex": 0,
        "ExceptionMethod": "8nTryGetConnectionnSystem.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089nSystem.Data.ProviderBase.DbConnectionPoolnBoolean TryGetConnection(System.Data.Common.DbConnection, UInt32, Boolean, Boolean, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal ByRef)",
        "HResult": -2146232060,
        "Source": ".Net SqlClient Data Provider",
        "WatsonBuckets": null
    },
    "HelpURL": null,
    "StackTraceString": "   at System.Data.Entity.Core.EntityClient.EntityConnection.Open()rn   at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)rn   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)rn   at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass41_0.<GetResults>b__0()rn   at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)rn   at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)rn   at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__31_0()rn   at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()rn   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)rn   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<>c__14`1.<GetElementFunction>b__14_1(IEnumerable`1 sequence)rn   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)rn   at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)rn   at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)rn   at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)rn   at PRJAPI.Helpers.MyHelper.LoadData(String dataNumber) in C:\Users\source\repos\Project\MySolution\PRJ\PRJAPI\Helpers\MyHelper.cs:line 398",
    "RemoteStackTraceString": null,
    "RemoteStackIndex": 0,
    "ExceptionMethod": "8nOpennEntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089nSystem.Data.Entity.Core.EntityClient.EntityConnectionnVoid Open()",
    "HResult": -2146233087,
    "Source": "EntityFramework",
    "WatsonBuckets": null
}

For what I see (but maybe its a false positive) the firewall between the app and sql server, sometime it drop a single TCP package in return from SQL Server; not sure if this is relevant or not.

The fact is: I can accept one connection to be broken (I could set a polly and a retry), but it blocks the following connection for such an hour, this make no sense at all?

Also: during this “downtime”, I can access to remote DB using the same credentials (or the same App from another Server), so that “Access Denied” its very strange.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật