-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot connect to (localdb) from .NET Core except via Named Pipe on Windows 11 ARM #1441
Comments
@benday, I have not looked into the repro you have provided or much in details just some quick notes, have you tried with ssms to see if that gets a connection? LocalDb can use two different connection strings.
The first one should be working without any issues, but there is an open issue for second one #1395 and PR #1433 is made to address issue. One other problem with Instance pipe name is if its state is stopped you wont be able to get a connection from Instance pipe name. make sure you have ran |
@JRahnama -- Thanks for that input. I hit that named pipe issue you mentioned but did a workaround a while back by simply setting Encrypt=false in the connection string. Not ideal but good enough to allow me to connect via "np:". Put another way, no issues for me on the ARM/Named Pipe thing. I tried the default instance syntax "(localdb)." that you suggested and I'm still getting the same error. The repro repo that I posted actually ensures that the localdb instance is running before attempting to connect to it. Per your question about SSMS, SSMS doesn't install on Win11 ARM. But I can connect to localdb using SQL Server Object Explorer in VS2022 running on ARM. What's extra strange is that I can connect to localdb using an app I wrote for dotnet 5 that's published to the store. https://www.microsoft.com/store/productId/9P5DZ9KQC7GR I think there is something about native .NET6 apps trying to connect that doesn't work from ARM. But that same code works fine when it's run in x86/x64 emulation under ARM. |
@benday is the app on net 5 using same username/password to get connection? If not, I would say you probably need to add user login to your localdb
and everything worked as expected. maybe I need to have Windows 11 ARM. Did you try it from Windows 11 Insider Preview Build? |
@JRahnama -- Yes, you'll definitely need a win11 arm machine to test this. As stated in the original bug report, everything works as expected on win11 on Intel x64. It fails on arm. Regarding the .net5 app running on win11 arm, I was connecting using "trusted connection=true" and that oddly worked fine. |
@benday can you try adding |
One more question here can you run dumpbin.exe /headers SqlUserInstance.dll in the path of |
I am having similar issue with .net 6.0 on regular intel dev laptop connecting to (localdb)\instancename in IIS. Does not work
Works
Exception
ConfigurationProcessor Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz 2.59 GHz Edition Windows 10 Enterprise Should I create a separate ticket? |
For some reason setting this flag:
in this is file:
fixed it for me. Is this the recommended approach? Source: |
Here's the output from dumpbin: |
I added a new test to the sample repo that adds that UseManagedNetworkingOnWindows call. The test still fails but it gives a different error message. The new error message is: System.Exception: Cannot connect to SQL Server Browser. Ensure SQL Server Browser has been started. ---> System.Net.Sockets.SocketException: No such host is known. |
Just wanted to report that this issue also concerns a native Windows 11 ARM installation on a Surface Pro X. Yet having troubles to install SQL Server 2019 at all (SQL Server Express, SQL Server Express Advanced and SSMS won't install without errors), the SQL Server 2019 LocalDB installation somehow manages to get through successfully. However, trying to access the local database via connection string Developing using VS Code, I installed the SQL server extension for VS Code (https://docs.microsoft.com/en-us/sql/tools/visual-studio-code/sql-server-develop-use-vscode). Interestingly enough, trying to access the LocalDB via connection string using this extension succeeds on ARM, even starting the database instance if previously stopped. I verified this behaviour calling The Microsoft Surface Pro X has been configurated with a Microsoft SQ2 Processor and 16 GB RAM, running Windows 11 Build 22000.434 on arm64. |
@Xenyr I think it should be: |
Absolutely, sorry for that typo. I had tested it with the backslash back then and therefore edited my comment. |
I am experiencing the same issue with Windows 11 Arm/EF 6.06 /Visual Studio 2022 and localDB. I can connect to localdb in SSMS and also visual studio server explorer, but running migrations (update-database) always gives an error about being unable to connect to localdb. I also tried a clean install of the new Visual Studio 2022 Preview (arm) thinking this would resolve it, but the issue is still there. "DefaultConnection": "Server=(localdb)\mssqllocaldb;Database=aspnet-demo6-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" Error Number:193,State:0,Class:20 |
Should have added also |
FYI, I tried re-running my repro repo code (https://github.com/benday-inc/Benday.ArmDemo1) using Visual Studio Enterprise 2022 (ARM 64-bit) Version 17.3.0 Preview 6.0. I'm still getting the same errors. It would be really nice to be able to work with some kind of SQL Server on ARM64. @JRahnama, are there any updates you could share on this? Thanks, |
@benday MSSQLLocalDb is not supported on Win11 ARM64 so far. The |
Ran into this issue when attempting to debug an ASP.NET 4.8 app on the Windows Dev Kit 2023 yesterday. Given that The VS 2022 ARM64 Preview installs SQL Server 2019 LocalDB as part of the ASP.NET/web development workload, I expected it would be ready. Curiously, Azure Data Studio connects and runs queries fine (including using the same connection string), and I was able to get a .NET 6 console app to connect and run a query, but only when the build configuration is set to x64 (and not ARM64). The ASP.NET 4.8 still has the same issue when running as x64. I've created a report in the Visual Studio feedback site, hopefully they're able to determine who owns the library and get it fixed. |
Same here, just bought an Surface Pro 9 SQ3 now that Visual Studio has support for ARM64, but it is not possible to connect to localdb (even though it installs together with supported workload) from NET7/EF7. Azure Data Studio ARM64 can connect successfully so no issue with localdb per se. |
I was curious if this was fixed under .NET Core 7 so I did an update to the repro repo. https://github.com/benday-inc/Benday.ArmDemo1/tree/update-to-dotnet-7 Answer: nope. Still broken. |
Been broken forever... |
I'm using a Mac and don't have the option for x86 or x64 ... did you create a new configuration or does VS show those on the Surface? |
Weirdly enough I've got an old app running RoundhousE, a database migration tool built against .NET 4.5 and uses some version of System.Data.dll. It's able to run migrations and populate the DB just fine. The app doesn't run with EF6 against SQL Local DB however, gets this error. |
I second @jbogard findings. I had a .NET Framework app (.NET Framework 4.8) that worked just fine with Local DB, then after migrating it to .NET Core (.NET 8 actually), it started showing errors about connecting. Same connection string and everything.
|
@JRahnama is a fix for this issue planned or will localdb remain unsupported on Windows on ARM devices? It would be useful to have this available to avoid having to run alternatives such as SQL Edge in Docker - Especially since the rest of the modern .NET toolchain is now ARM Native (I think Azure functions are still an issue, but web and mobile has been a great experience so far) |
I got around this on my Mac Windows/Arm VM just using these alternative install scripts. The SQL express or any of the normal modern SQL servers run fine for me, I didn't try the native localdb but it may work also. You can just install the SQL server developer version and it should work. https://github.com/jimm98y/MSSQLEXPRESS-M1-Install I also did this as well prior so enable visual studio to connect using the arm64 dll for sql client.
|
I worked around the issue by creating a SQL alias for the localdb named pipes connection and keeping that up to date (with the latest named pipes value for the localdb instance) via a scheduled task. Then your connection string server becomes LocalDbAlias, which is good enough for me. |
Just an FYI, I went this route as well to get "normal" SQL working, but it doesn't work for SQL Local DB. Unfortunately. |
I am having the same issue - using Microsoft Surface Pro 11 with Windows 11. I have been able to work around it building as x64 but cannot see LocalDB from Visual Studio itself. |
Description
I'm trying to connect to SQL Server Express LocalDB from .NET Core 6 on Windows 11 ARM. If I use a connection string that refers to it using the instance name "Data Source=(localdb)\MSSQLLocalDB", it fails with the exception below. If I connect to it using a named pipe, it works.
I've created some simple MSTest unit tests to repro the problem. There are two test methods in the DatabaseConnectionFixture class that attempt to connect to LocalDB: one uses an ordinary connection string and the other uses a named pipe. On Windows 11 ARM, the
ConnectToDatabase_ConnectionString()
method fails. If I run this same code on Windows 11 x64, both tests pass.Configuration
This is running on Windows 11 ARM in a Parallels VM on an M1 MacBook Pro. The OS Build # is 22509.1011. The dotnet core build is 6.0.100.
The text was updated successfully, but these errors were encountered: