简体   繁体   中英

ASP.NET 4.5 Connection string to SQL Server 2019 - "An error occurred while communicating with the database"

So my company has an old legacy .NET 4.5 web application running on IIS (version 8.5.9600.16384) in which it's application database resides on Microsoft SQL Server 2014 (SP3)... This works perfectly fine.

However (due to decommissioning / upgrades) we want to move the database to our SQL Server 2019 Server. So I took the original .NET package and re-imported it >> during the wizard I entered the SQL Server 2019 Server / db path and renamed the solution name with '_TEST' suffix >> then restarted IIS. The resulting connection string looks like this (as expected / mirroring the original working one however with the new server / db / uname): connection string in IIS

When I go to test logging in to the web application (via IE11), I get the following "an error occurred while communicating with the database" error after clicking login: Error message

We also tested the same exact SQL Server 2019 connection string through Powershell on this same web server and we are able to connect into the database, so it would seem that there's some mechanism failing inside the .NET application whether there's a configuration or driver not quite right somewhere.

Does anyone have any suggestions as to what I could potentially try next or what the issue might be here?

It seems you need to use the correct connectionstring. I know it works in your previous sql server 2014. Please follow the below steps to get the connection string, and replace it in your web.config . And the settings sync to your IIS.

If there also have any errors, you can update your post.

Steps

  1. open your vs2019, and open sql server object explorer .

    在此处输入图像描述

  2. Add new server, and type the information to connect your sql server 2019.

    在此处输入图像描述

  3. After connect to the sql server, please click the Properties to copy the Connection string .

    在此处输入图像描述

    在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM