efcore icon indicating copy to clipboard operation
efcore copied to clipboard

SQL server alias recognized in dnx451 but not in dnxcore50

Open ketrex2 opened this issue 11 years ago • 6 comments

I built a web application utilizing EntityFramework and the new Identity libraries. I also set up a SQL configuration alias in SQL server configuration manager. When running my application with the dnx451 runtime, the database connection is established with no problem and the application functions.

If I switch the runtime to dnxcore50, any attempts to connect to the database from the application fail with the SqlException The network path was not found. Replacing the alias in the connection string and using the actual server name resolves the issue. The connection string I'm using is included below:

"connectionString": "Server=aliasName;Database=dbName;Trusted_Connection=True;MultipleActiveResultSets=true"

ketrex2 avatar Jul 24 '15 21:07 ketrex2

@Phasiq any chance you could try this out using DbConnection directly to see if it is an EF specific issue, or an issue in SQL Client itself?

rowanmiller avatar Jul 30 '15 18:07 rowanmiller

@rowanmiller, thanks for the tip. As suggested, I bypassed EF and tested with a SqlConnection (DbConnection) object and it fails when using a SQL alias in core50 but succeeds in 4.51 and 4.6. It is most definitely not an EF issue.

Any suggestion on where I should report this behavior? It's quite an interesting gotcha to have SQL aliases work in .NET and fail in .NET core, but I suppose it could be by design given the more minimal code base.

ketrex2 avatar Jul 30 '15 23:07 ketrex2

The System.Data.SqlClient code will ultimately live in the dotnet/corefx repo. You could try filing an issue there.

bricelam avatar Jul 31 '15 03:07 bricelam

@YoungGah FYI

divega avatar Jul 31 '15 05:07 divega

Thanks @bricelam , I have posted it in the corefx repo as suggested.

ketrex2 avatar Jul 31 '15 15:07 ketrex2

New issue is https://github.com/dotnet/corefx/issues/2575.

divega avatar Jul 31 '15 17:07 divega