The error message is very clear. An instance of MS SQL Server named "
.\MSSQLSERVER2022
" does NOT exist on server machine or is NOT accessible from the WAN.
You can resolve your issue by doing the following:
1) check connection string, especially the name of MS SQL Server instance
See the examples of proper connections strings:
SQL Server connection strings - ConnectionStrings.com[
^]
2) If it's correct, configure MS SQL Server to be visible from outside
See:
Lesson 2: Connecting from Another Computer - SQL Server | Microsoft Learn[
^]
3) If you can NOT use your machine to act as an sql server, you'll need to find a service (provider).
BTW: if you store the connection string in your code, i'd strongly recommend to move it into configuration file. Please read this:
Connection Strings and Configuration Files - ADO.NET | Microsoft Learn[
^]
Connection Strings - EF Core | Microsoft Learn[
^]