Skip to content

Unable to cast object of type 'Microsoft.Data.ProviderBase.DbConnectionClosedConnecting' to type 'Microsoft.Data.SqlClient.SqlInternalConnectionTds' #3314

@mrvogiacu

Description

@mrvogiacu

Describe the bug

When I start the NET CORE API, and refresh my website client. I got this exception

System.InvalidCastException: Unable to cast object of type 'Microsoft.Data.ProviderBase.DbConnectionClosedConnecting' to type 'Microsoft.Data.SqlClient.SqlInternalConnectionTds'.
   at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
   at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
   at Microsoft.Data.SqlClient.SqlConnection.Open()

To reproduce

Not sure how to reproduce. I see this exception happened when the API is just starting, or the API wakup after idle a long time

Expected behavior

A clear and concise description of what you expected to happen.

Further technical details

NET 8
SQL Server 2022
IIS 10

Metadata

Metadata

Labels

Needs More Info ℹ️Issues that have insufficient information to pursue investigationsTriage Done ✔️Issues that are triaged by dev team and are in investigation.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions