Upgrading .NET Core from 2.1 to 2.2 results in SQL connection errorsHow to run .NET Core console app from the command lineCommand line to install/upgrade .NET CoreErrors upgrading .NET Core app to 1.1Can not connect to sql server from docker supported asp.net core projectIWebHost.Build() is not calling Startup.Configure() after upgrading to .Net Core 2.1.Net Core 2.1 Socket ServerHow can I upgrade from .Net Core 2.1 RC1 to the stable version of .NET Core 2.1?Publish failed when using Microsoft.NET.Sdk.Razor if reference was not recognized, but build works.Net Core 2.1 System.IO.FileSystem.DriveInfoThe Current .Net SDK does not support targeting .Net Core 2.2 Target .Net Core 2.1 or Lower

Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?

Find max number you can create from an array of numbers

Is it acceptable that I plot a time-series figure with years increasing from right to left?

Can you take the Dodge action while prone?

How to supply water to a coastal desert town with no rain and no freshwater aquifers?

Should I increase my 401(k) contributions, or increase my mortgage payments

Advice for making/keeping shredded chicken moist?

What are some bad ways to subvert tropes?

Will Jimmy fall off his platform?

What causes a fastener to lock?

What is exact meaning of “ich wäre gern”?

What's the difference between a type and a kind?

What is the fundamental difference between catching whales and hunting other animals?

What happens if the limit of 4 billion files was exceeded in an ext4 partition?

What's the big deal about the Nazgûl losing their horses?

What instances can be solved today by modern solvers (pure LP)?

How serious is plagiarism in a master’s thesis?

Why would "dead languages" be the only languages that spells could be written in?

Taking my Ph.D. advisor out for dinner after graduation

Why is there paternal, for fatherly, fraternal, for brotherly, but no similar word for sons?

How to reclaim personal item I've lent to the office without burning bridges?

What is the difference between an "empty interior" and a "hole" in topology?

What is the shape of the upper boundary of water hitting a screen?

Do intermediate subdomains need to exist?



Upgrading .NET Core from 2.1 to 2.2 results in SQL connection errors


How to run .NET Core console app from the command lineCommand line to install/upgrade .NET CoreErrors upgrading .NET Core app to 1.1Can not connect to sql server from docker supported asp.net core projectIWebHost.Build() is not calling Startup.Configure() after upgrading to .Net Core 2.1.Net Core 2.1 Socket ServerHow can I upgrade from .Net Core 2.1 RC1 to the stable version of .NET Core 2.1?Publish failed when using Microsoft.NET.Sdk.Razor if reference was not recognized, but build works.Net Core 2.1 System.IO.FileSystem.DriveInfoThe Current .Net SDK does not support targeting .Net Core 2.2 Target .Net Core 2.1 or Lower






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I had a working API site running on IIS. Then I upgraded my solution from .NET Core 2.1 to 2.2, and I'm getting the following error now:



 "ExceptionDetail": {
"Type": "System.InvalidOperationException",
"HResult": -2146233079,
"Message": "An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseSqlServer' call.",
"Source": "Microsoft.EntityFrameworkCore.SqlServer",
"InnerException":
"Data":
"HelpLink.ProdName": "Microsoft SQL Server",
"HelpLink.EvtSrc": "MSSQLServer",
"HelpLink.EvtID": "10060",
"HelpLink.BaseHelpUrl": "http://go.microsoft.com/fwlink",
"HelpLink.LinkId": "20476"
,
"HResult": -2146232060,
"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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)",
"Source": "Core .Net SqlClient Data Provider",
"InnerException":
"HResult": -2147467259,
"Message": "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond",
"Source": null,
"NativeErrorCode": 10060,
"ErrorCode": -2147467259,
"Type": "System.ComponentModel.Win32Exception"
,
"Errors": [

"Source": "Core .Net SqlClient Data Provider",
"Number": 10060,
"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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)",
"Procedure": null,
"LineNumber": 0

],
"ClientConnectionId": "00000000-0000-0000-0000-000000000000",
"Class": 20,
"LineNumber": 0,
"Number": 10060,
"Procedure": null,
"Server": "",
"State": 0,
"ErrorCode": -2146232060,
"Type": "System.Data.SqlClient.SqlException"



I reverted back to my old 2.1 code, and it worked. I also published a self-contained solution and still getting the same error. I also set .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);



My Service project references the Application project which references the database project, and here are the project files:



Services:



<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0021</NoWarn>
<OutputPath></OutputPath>
<DocumentationFile>objDebugnetcoreapp2.1CaseManagement.Service.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Sharednetcoreapp2.1**" />
<Content Remove="Sharednetcoreapp2.1**" />
<EmbeddedResource Remove="Sharednetcoreapp2.1**" />
<None Remove="Sharednetcoreapp2.1**" />
</ItemGroup>



<ItemGroup>
<Folder Include="wwwroot" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.ApplicationCaseManagement.Application.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Production.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Staging.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="PropertieslaunchSettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>


Application:



<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0021;1591</NoWarn>
<DocumentationFile>objDebugnetcoreapp2.1CaseManagement.Application.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.CoreCaseManagement.Core.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.DatabaseCaseManagement.Infrastructure.Database.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc.Core">
<HintPath>............Program FilesdotnetsdkNuGetFallbackFoldermicrosoft.aspnetcore.mvc.core2.1.1libnetstandard2.0Microsoft.AspNetCore.Mvc.Core.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.Annotations">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.annotations4.0.1libnetstandard2.0Swashbuckle.AspNetCore.Annotations.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.Swagger">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.swagger4.0.1libnetstandard2.0Swashbuckle.AspNetCore.Swagger.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.SwaggerGen">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.swaggergen4.0.1libnetstandard2.0Swashbuckle.AspNetCore.SwaggerGen.dll</HintPath>
</Reference>
</ItemGroup>

</Project>



Database:



<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
<AssemblyName>CaseManagement.Infrastructure.Database</AssemblyName>
<RootNamespace>CaseManagement.Infrastructure.Database</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.3" />
</ItemGroup>

<ItemGroup>
<Folder Include="RepoShared" />
<Folder Include="SqlStoredProcedures" />
<Folder Include="SqlTables" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System">
<HintPath>System</HintPath>
</Reference>
</ItemGroup>

</Project>



Not sure what else I can do.










share|improve this question
























  • A network-related or instance-specific error occurred while establishing a connection to SQL Server. -> it says i can't find db you give me invalid connection string. So you can look your data context class' constructor. Check your ConnectionString true or false;

    – Batuhan
    Mar 26 at 12:13











  • I double checked that. The connection string is correct. I also replaced it with the working version (2.1).

    – user1786037
    Mar 26 at 12:26











  • Is the db context has empty constructor ?

    – Batuhan
    Mar 26 at 12:27











  • Yes, it's empty.

    – user1786037
    Mar 26 at 12:50






  • 1





    @Batuhan, you were correct, although I'm not sure why. When I logged the connection string, I saw it was trying to connect to a production database, but I don't understand where it got the connection string from. I have multiple appsetting files, one for each environment. So the first question is: Why did it pick up the production.appsettings file. The second question is, even after updating the connection string in the file and re-starting IIS and the app pool, it still read production, a connection string that is not found in any file or in my code.

    – user1786037
    Mar 26 at 13:17


















0















I had a working API site running on IIS. Then I upgraded my solution from .NET Core 2.1 to 2.2, and I'm getting the following error now:



 "ExceptionDetail": {
"Type": "System.InvalidOperationException",
"HResult": -2146233079,
"Message": "An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseSqlServer' call.",
"Source": "Microsoft.EntityFrameworkCore.SqlServer",
"InnerException":
"Data":
"HelpLink.ProdName": "Microsoft SQL Server",
"HelpLink.EvtSrc": "MSSQLServer",
"HelpLink.EvtID": "10060",
"HelpLink.BaseHelpUrl": "http://go.microsoft.com/fwlink",
"HelpLink.LinkId": "20476"
,
"HResult": -2146232060,
"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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)",
"Source": "Core .Net SqlClient Data Provider",
"InnerException":
"HResult": -2147467259,
"Message": "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond",
"Source": null,
"NativeErrorCode": 10060,
"ErrorCode": -2147467259,
"Type": "System.ComponentModel.Win32Exception"
,
"Errors": [

"Source": "Core .Net SqlClient Data Provider",
"Number": 10060,
"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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)",
"Procedure": null,
"LineNumber": 0

],
"ClientConnectionId": "00000000-0000-0000-0000-000000000000",
"Class": 20,
"LineNumber": 0,
"Number": 10060,
"Procedure": null,
"Server": "",
"State": 0,
"ErrorCode": -2146232060,
"Type": "System.Data.SqlClient.SqlException"



I reverted back to my old 2.1 code, and it worked. I also published a self-contained solution and still getting the same error. I also set .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);



My Service project references the Application project which references the database project, and here are the project files:



Services:



<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0021</NoWarn>
<OutputPath></OutputPath>
<DocumentationFile>objDebugnetcoreapp2.1CaseManagement.Service.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Sharednetcoreapp2.1**" />
<Content Remove="Sharednetcoreapp2.1**" />
<EmbeddedResource Remove="Sharednetcoreapp2.1**" />
<None Remove="Sharednetcoreapp2.1**" />
</ItemGroup>



<ItemGroup>
<Folder Include="wwwroot" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.ApplicationCaseManagement.Application.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Production.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Staging.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="PropertieslaunchSettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>


Application:



<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0021;1591</NoWarn>
<DocumentationFile>objDebugnetcoreapp2.1CaseManagement.Application.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.CoreCaseManagement.Core.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.DatabaseCaseManagement.Infrastructure.Database.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc.Core">
<HintPath>............Program FilesdotnetsdkNuGetFallbackFoldermicrosoft.aspnetcore.mvc.core2.1.1libnetstandard2.0Microsoft.AspNetCore.Mvc.Core.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.Annotations">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.annotations4.0.1libnetstandard2.0Swashbuckle.AspNetCore.Annotations.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.Swagger">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.swagger4.0.1libnetstandard2.0Swashbuckle.AspNetCore.Swagger.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.SwaggerGen">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.swaggergen4.0.1libnetstandard2.0Swashbuckle.AspNetCore.SwaggerGen.dll</HintPath>
</Reference>
</ItemGroup>

</Project>



Database:



<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
<AssemblyName>CaseManagement.Infrastructure.Database</AssemblyName>
<RootNamespace>CaseManagement.Infrastructure.Database</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.3" />
</ItemGroup>

<ItemGroup>
<Folder Include="RepoShared" />
<Folder Include="SqlStoredProcedures" />
<Folder Include="SqlTables" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System">
<HintPath>System</HintPath>
</Reference>
</ItemGroup>

</Project>



Not sure what else I can do.










share|improve this question
























  • A network-related or instance-specific error occurred while establishing a connection to SQL Server. -> it says i can't find db you give me invalid connection string. So you can look your data context class' constructor. Check your ConnectionString true or false;

    – Batuhan
    Mar 26 at 12:13











  • I double checked that. The connection string is correct. I also replaced it with the working version (2.1).

    – user1786037
    Mar 26 at 12:26











  • Is the db context has empty constructor ?

    – Batuhan
    Mar 26 at 12:27











  • Yes, it's empty.

    – user1786037
    Mar 26 at 12:50






  • 1





    @Batuhan, you were correct, although I'm not sure why. When I logged the connection string, I saw it was trying to connect to a production database, but I don't understand where it got the connection string from. I have multiple appsetting files, one for each environment. So the first question is: Why did it pick up the production.appsettings file. The second question is, even after updating the connection string in the file and re-starting IIS and the app pool, it still read production, a connection string that is not found in any file or in my code.

    – user1786037
    Mar 26 at 13:17














0












0








0








I had a working API site running on IIS. Then I upgraded my solution from .NET Core 2.1 to 2.2, and I'm getting the following error now:



 "ExceptionDetail": {
"Type": "System.InvalidOperationException",
"HResult": -2146233079,
"Message": "An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseSqlServer' call.",
"Source": "Microsoft.EntityFrameworkCore.SqlServer",
"InnerException":
"Data":
"HelpLink.ProdName": "Microsoft SQL Server",
"HelpLink.EvtSrc": "MSSQLServer",
"HelpLink.EvtID": "10060",
"HelpLink.BaseHelpUrl": "http://go.microsoft.com/fwlink",
"HelpLink.LinkId": "20476"
,
"HResult": -2146232060,
"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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)",
"Source": "Core .Net SqlClient Data Provider",
"InnerException":
"HResult": -2147467259,
"Message": "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond",
"Source": null,
"NativeErrorCode": 10060,
"ErrorCode": -2147467259,
"Type": "System.ComponentModel.Win32Exception"
,
"Errors": [

"Source": "Core .Net SqlClient Data Provider",
"Number": 10060,
"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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)",
"Procedure": null,
"LineNumber": 0

],
"ClientConnectionId": "00000000-0000-0000-0000-000000000000",
"Class": 20,
"LineNumber": 0,
"Number": 10060,
"Procedure": null,
"Server": "",
"State": 0,
"ErrorCode": -2146232060,
"Type": "System.Data.SqlClient.SqlException"



I reverted back to my old 2.1 code, and it worked. I also published a self-contained solution and still getting the same error. I also set .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);



My Service project references the Application project which references the database project, and here are the project files:



Services:



<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0021</NoWarn>
<OutputPath></OutputPath>
<DocumentationFile>objDebugnetcoreapp2.1CaseManagement.Service.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Sharednetcoreapp2.1**" />
<Content Remove="Sharednetcoreapp2.1**" />
<EmbeddedResource Remove="Sharednetcoreapp2.1**" />
<None Remove="Sharednetcoreapp2.1**" />
</ItemGroup>



<ItemGroup>
<Folder Include="wwwroot" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.ApplicationCaseManagement.Application.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Production.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Staging.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="PropertieslaunchSettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>


Application:



<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0021;1591</NoWarn>
<DocumentationFile>objDebugnetcoreapp2.1CaseManagement.Application.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.CoreCaseManagement.Core.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.DatabaseCaseManagement.Infrastructure.Database.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc.Core">
<HintPath>............Program FilesdotnetsdkNuGetFallbackFoldermicrosoft.aspnetcore.mvc.core2.1.1libnetstandard2.0Microsoft.AspNetCore.Mvc.Core.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.Annotations">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.annotations4.0.1libnetstandard2.0Swashbuckle.AspNetCore.Annotations.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.Swagger">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.swagger4.0.1libnetstandard2.0Swashbuckle.AspNetCore.Swagger.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.SwaggerGen">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.swaggergen4.0.1libnetstandard2.0Swashbuckle.AspNetCore.SwaggerGen.dll</HintPath>
</Reference>
</ItemGroup>

</Project>



Database:



<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
<AssemblyName>CaseManagement.Infrastructure.Database</AssemblyName>
<RootNamespace>CaseManagement.Infrastructure.Database</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.3" />
</ItemGroup>

<ItemGroup>
<Folder Include="RepoShared" />
<Folder Include="SqlStoredProcedures" />
<Folder Include="SqlTables" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System">
<HintPath>System</HintPath>
</Reference>
</ItemGroup>

</Project>



Not sure what else I can do.










share|improve this question
















I had a working API site running on IIS. Then I upgraded my solution from .NET Core 2.1 to 2.2, and I'm getting the following error now:



 "ExceptionDetail": {
"Type": "System.InvalidOperationException",
"HResult": -2146233079,
"Message": "An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseSqlServer' call.",
"Source": "Microsoft.EntityFrameworkCore.SqlServer",
"InnerException":
"Data":
"HelpLink.ProdName": "Microsoft SQL Server",
"HelpLink.EvtSrc": "MSSQLServer",
"HelpLink.EvtID": "10060",
"HelpLink.BaseHelpUrl": "http://go.microsoft.com/fwlink",
"HelpLink.LinkId": "20476"
,
"HResult": -2146232060,
"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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)",
"Source": "Core .Net SqlClient Data Provider",
"InnerException":
"HResult": -2147467259,
"Message": "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond",
"Source": null,
"NativeErrorCode": 10060,
"ErrorCode": -2147467259,
"Type": "System.ComponentModel.Win32Exception"
,
"Errors": [

"Source": "Core .Net SqlClient Data Provider",
"Number": 10060,
"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: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)",
"Procedure": null,
"LineNumber": 0

],
"ClientConnectionId": "00000000-0000-0000-0000-000000000000",
"Class": 20,
"LineNumber": 0,
"Number": 10060,
"Procedure": null,
"Server": "",
"State": 0,
"ErrorCode": -2146232060,
"Type": "System.Data.SqlClient.SqlException"



I reverted back to my old 2.1 code, and it worked. I also published a self-contained solution and still getting the same error. I also set .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);



My Service project references the Application project which references the database project, and here are the project files:



Services:



<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0021</NoWarn>
<OutputPath></OutputPath>
<DocumentationFile>objDebugnetcoreapp2.1CaseManagement.Service.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Sharednetcoreapp2.1**" />
<Content Remove="Sharednetcoreapp2.1**" />
<EmbeddedResource Remove="Sharednetcoreapp2.1**" />
<None Remove="Sharednetcoreapp2.1**" />
</ItemGroup>



<ItemGroup>
<Folder Include="wwwroot" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.ApplicationCaseManagement.Application.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Production.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Staging.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="PropertieslaunchSettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>


Application:



<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0021;1591</NoWarn>
<DocumentationFile>objDebugnetcoreapp2.1CaseManagement.Application.xml</DocumentationFile>
<OutputPath></OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.CoreCaseManagement.Core.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.DatabaseCaseManagement.Infrastructure.Database.csproj" />
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc.Core">
<HintPath>............Program FilesdotnetsdkNuGetFallbackFoldermicrosoft.aspnetcore.mvc.core2.1.1libnetstandard2.0Microsoft.AspNetCore.Mvc.Core.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.Annotations">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.annotations4.0.1libnetstandard2.0Swashbuckle.AspNetCore.Annotations.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.Swagger">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.swagger4.0.1libnetstandard2.0Swashbuckle.AspNetCore.Swagger.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.AspNetCore.SwaggerGen">
<HintPath>............Usersdinua.nugetpackagesswashbuckle.aspnetcore.swaggergen4.0.1libnetstandard2.0Swashbuckle.AspNetCore.SwaggerGen.dll</HintPath>
</Reference>
</ItemGroup>

</Project>



Database:



<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<Configurations>Debug;Release;Production</Configurations>
<AssemblyName>CaseManagement.Infrastructure.Database</AssemblyName>
<RootNamespace>CaseManagement.Infrastructure.Database</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.3" />
</ItemGroup>

<ItemGroup>
<Folder Include="RepoShared" />
<Folder Include="SqlStoredProcedures" />
<Folder Include="SqlTables" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..CaseManagement.Infrustructure.LogCaseManagement.Infrastructure.Log.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System">
<HintPath>System</HintPath>
</Reference>
</ItemGroup>

</Project>



Not sure what else I can do.







asp.net-core .net-core






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 0:04









Moien Tajik

1,2572 gold badges10 silver badges27 bronze badges




1,2572 gold badges10 silver badges27 bronze badges










asked Mar 25 at 19:51









user1786037user1786037

357 bronze badges




357 bronze badges












  • A network-related or instance-specific error occurred while establishing a connection to SQL Server. -> it says i can't find db you give me invalid connection string. So you can look your data context class' constructor. Check your ConnectionString true or false;

    – Batuhan
    Mar 26 at 12:13











  • I double checked that. The connection string is correct. I also replaced it with the working version (2.1).

    – user1786037
    Mar 26 at 12:26











  • Is the db context has empty constructor ?

    – Batuhan
    Mar 26 at 12:27











  • Yes, it's empty.

    – user1786037
    Mar 26 at 12:50






  • 1





    @Batuhan, you were correct, although I'm not sure why. When I logged the connection string, I saw it was trying to connect to a production database, but I don't understand where it got the connection string from. I have multiple appsetting files, one for each environment. So the first question is: Why did it pick up the production.appsettings file. The second question is, even after updating the connection string in the file and re-starting IIS and the app pool, it still read production, a connection string that is not found in any file or in my code.

    – user1786037
    Mar 26 at 13:17


















  • A network-related or instance-specific error occurred while establishing a connection to SQL Server. -> it says i can't find db you give me invalid connection string. So you can look your data context class' constructor. Check your ConnectionString true or false;

    – Batuhan
    Mar 26 at 12:13











  • I double checked that. The connection string is correct. I also replaced it with the working version (2.1).

    – user1786037
    Mar 26 at 12:26











  • Is the db context has empty constructor ?

    – Batuhan
    Mar 26 at 12:27











  • Yes, it's empty.

    – user1786037
    Mar 26 at 12:50






  • 1





    @Batuhan, you were correct, although I'm not sure why. When I logged the connection string, I saw it was trying to connect to a production database, but I don't understand where it got the connection string from. I have multiple appsetting files, one for each environment. So the first question is: Why did it pick up the production.appsettings file. The second question is, even after updating the connection string in the file and re-starting IIS and the app pool, it still read production, a connection string that is not found in any file or in my code.

    – user1786037
    Mar 26 at 13:17

















A network-related or instance-specific error occurred while establishing a connection to SQL Server. -> it says i can't find db you give me invalid connection string. So you can look your data context class' constructor. Check your ConnectionString true or false;

– Batuhan
Mar 26 at 12:13





A network-related or instance-specific error occurred while establishing a connection to SQL Server. -> it says i can't find db you give me invalid connection string. So you can look your data context class' constructor. Check your ConnectionString true or false;

– Batuhan
Mar 26 at 12:13













I double checked that. The connection string is correct. I also replaced it with the working version (2.1).

– user1786037
Mar 26 at 12:26





I double checked that. The connection string is correct. I also replaced it with the working version (2.1).

– user1786037
Mar 26 at 12:26













Is the db context has empty constructor ?

– Batuhan
Mar 26 at 12:27





Is the db context has empty constructor ?

– Batuhan
Mar 26 at 12:27













Yes, it's empty.

– user1786037
Mar 26 at 12:50





Yes, it's empty.

– user1786037
Mar 26 at 12:50




1




1





@Batuhan, you were correct, although I'm not sure why. When I logged the connection string, I saw it was trying to connect to a production database, but I don't understand where it got the connection string from. I have multiple appsetting files, one for each environment. So the first question is: Why did it pick up the production.appsettings file. The second question is, even after updating the connection string in the file and re-starting IIS and the app pool, it still read production, a connection string that is not found in any file or in my code.

– user1786037
Mar 26 at 13:17






@Batuhan, you were correct, although I'm not sure why. When I logged the connection string, I saw it was trying to connect to a production database, but I don't understand where it got the connection string from. I have multiple appsetting files, one for each environment. So the first question is: Why did it pick up the production.appsettings file. The second question is, even after updating the connection string in the file and re-starting IIS and the app pool, it still read production, a connection string that is not found in any file or in my code.

– user1786037
Mar 26 at 13:17













0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55345410%2fupgrading-net-core-from-2-1-to-2-2-results-in-sql-connection-errors%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55345410%2fupgrading-net-core-from-2-1-to-2-2-results-in-sql-connection-errors%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript