Visual Studio 2022 localdb ((localdb)\MSSQLLocalDB) (ASP.NET Core) - sql-server

Visual Studio 2022 localdb ((localdb)\MSSQLLocalDB) (running on ASP.NET Core).
My problem is: I want to change from VS2019 to VS2022.
VS2019 and SSMS works totally fine. localdb works
VS2022 have from the first installation no connection to localDB
I can create a new DB and connect it but that is not what I want. I want the connection to the localDB.
What I already tried:
Reinstall VS2022
Reinstall localDB
Disconnect VS2019 and VS 2022 and reconnect. VS2019 works and VS2022 does not
I also followed the Microsoft docs; nothing helped
Followed many Stack Overflow discussions
If I try to connect to (localdb)\MSSQLLocalDB, I get this error
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (.Net SqlClient Data Provider)
If I try to start the ASP.NET Core app, I get this error:
IOException: IDX20807: Unable to retrieve document from: 'System.String'. HttpResponseMessage: 'System.Net.Http.HttpResponseMessage', HttpResponseMessage.Content: 'System.String'.
Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(string address, CancellationToken cancel)
InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
Microsoft.IdentityModel.Protocols.ConfigurationManager.GetConfigurat ionAsync(CancellationToken cancel)
I know this problem is really wired, but maybe one of you has an idea that helps.
I'm thankful for any help. :)

i was asking the question and found a solution.
Open CMD (windows + R)
SqlLocalDB.exe s MSSQLLocalDB
SqlLocalDB.exe i MSSQLLocalDB
Copy the path of Instance pipe name:. it should be something like: np:\......
use the path as servername when you in go to visual studio -> Add SQL Server
this works for me.

Follow up to above answer:
o Open CMD window
o cd C:
o dir SqlLocal*.exe /s /p
this should give you the path to localdb provider
o cd C:\Program Files\Microsoft SQL Server\150\Tools\Binn
Find your instance name
o SqlLocalDB.exe i
o SqlLocalDB.exe start to start the default instance

Related

Unable to install SQL Server (setup.exe)

I used SQL Server 2019 express version on my laptop butI uninstalled. Now I am trying to install SQL Server 2019 Developer edition but I get an error:
Exit code (Decimal): -2068119551 Exit message: Cannot find registry key 'SOFTWARE\Microsoft\Microsoft SQL Server\150\ConfigurationState'.
Error description: Invalid command line argument. Consult the windows installer SDK for detailed command line help.
Environment: Dell/Inspiron/Windows 10 Home/16gb ram/256 SSD / 1TB HDD /Corei7
Can anyone help me how to solve the problem? Thanks
PS: attaching screenshot for kind reference
You can try below options, based on the reference article
Run the setup.exe again, repair the installation.
Run the Setup.exe as administrator
See whether you have clearly uninstalled the previous SQL Server setup and try again.
Did you modify the registry setting earlier. If so, please revert the changes and try the installation. Eg., changing the default installation to D:, instead of C: etc.
I fed up the below problem
Unable to install SQL Server (setup.exe).
Exit code (Decimal): -2068119551 Exit message: Cannot find registry key 'SOFTWARE\Microsoft\Microsoft SQL Server\150\ConfigurationState'. Error description: The specified service does not exist as an installed service.
I fixed the above problem
DR-2033 avatar image
Click to vote
1 Vote"
1
DR-2033 answered • Dec 21 2021 at 4:03 AM | EricK-0825 commented • Mar 21 2022 at 3:20 AM
Unable to install SQL Server (setup.exe)

MSSQL Insatalation error - perflib 2.0 counter removal failed with exit code 2

I am trying to install SQL2019 Server.
comming This Error. cant Installation
TITLE: Microsoft SQL Server 2019 Setup
The following error has occurred:
PerfLib 2.0 counter removal failed with exit code 2. Command line:
C:\WINDOWS\system32\unlodctr.exe /m:hkengperfctr.xml from directory
C:\Program Files\Microsoft SQL Server\150\Shared.
• There is incomplete uninstallation of SQL server and we are not able to install in SQL server in your PC due to below errors.
• Database Engine services Failed
• PerfLib 2.0 counter removal failed with exit code 2.
• The MOF compiler could not connect with the WMI server.
• Below is troubleshooter link and search window
https://support.microsoft.com/en-us/topic/fix-problems-that-block-programs-from-being-installed-or-removed-cca7d1b6-65a9-3d98-426b-e9f927e1eb4d
• Here, you have to download the troubleshooter in your PC
• After download, you have to run the file and you will get below window & click Next
• Choose based on issue, its related to Installation or Uninstallation
• Choose one by one all relevant SQL Server content and uninstall, it will repeat each time for one item. Once you have done with all SQL server content, then only uninstall successful. Now you have good to install and without any issue.

Trying to install SQL Server 2012 on win 7. Its a 64-bit machine. I get the following error

TITLE: Microsoft SQL Server 2012 Setup
The following error has occurred:
An error occurred during the installation of assembly 'Microsoft.VC80.ATL, version="8.0.50727.6229", publicKeyToken="1fc8b3b9a1e18e3b", processorArchitecture="x86",type="win32"'.
Please refer to Help and Support for more information.
HRESULT: 0x80070422.
The problem was with Windows update.The "Windows Module installer" service was disabled once i enabled it and cleared up all the updates in C:\Windows\software distribution folder, it started updating and when i install the sqlserver-2012 i dint get that error anymore.
This is where i found about the service.
https://answers.microsoft.com/en-us/windows/forum/all/windows-update-error-80070422/372f6482-ff7c-4f92-858c-228b637bfae4

Unable to connect to localdb on Visual Studio 2013 using angular-js

I'm following this tutorial : http://chsakell.com/2015/08/23/building-single-page-applications-using-web-api-and-angularjs-free-e-book/
And below is the connection string:
<add name="HomeCinema" connectionString="Data Source=(LocalDb)\v11.0;
Initial Catalog=HomeCinema;Integrated Security=SSPI;
MultipleActiveResultSets=true"
providerName="System.Data.SqlClient" />
When I try to run update-database -verbose on the command-line, I'm getting the following error:
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I'm trying to connect to the LocalDB that comes with Visual Studio 2013.
When I look at the output:
Target database is: 'HomeCinema'
(DataSource: .\SQLEXPRESS, Provider: System.Data.SqlClient, Origin: Convention).
This is the constructor:
public HomeCinemaContext()
: base("HomeCinema")
{
Database.SetInitializer<HomeCinemaContext>(null);
}
Thank you.
I know this is already old, but what I did to run the command successfully was set HomeCinema.Data as the startup project before running the update-database -verbose command. I think this is so that the command will use the app.config in the HomeCinema.Data project where the connection string is specified.
Referring to one of the comments in the article, I think you can also use the following command. This is assuming that you have HomeCinema.Web as your startup project and that your connection string is set in the Web.config.
update-database -verbose -ProjectName "HomeCinema.Data" -StartupProjectName "HomeCinema.Web" -ConnectionStringName "HomeCinema"

SQL Server installation is either corrupt or has been tampered with error getting instance id from name

I installed SQL Server 2012 now. When I try to open the exe file from the installed path,
C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\Binn
I get the following error:
SQL Server installation is either corrupt or has been tampered with error getting instance id from name
I tried through command prompt too. I uninstalled again and tried again also and facing the same problem. Please help me on this. :(
From SQL Configuration Manager --> SQL Server Services --> SQL Server(SQLEXPRESS):
Binary Path will be: "c:\Program Files..\Binn\sqlservr.exe" -sSQLEXPRESS
So, try in CMD from path: ..\Binn> sqlservr.exe -sSQLEXPRESS. This should start the service.

Resources