question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: Use SQL Server security for connection strings on Linux

See original GitHub issue

From @badersur on July 13, 2017 21:3

Steps to reproduce

  1. dotnet new mvc -au Individual -uld true

  2. dotnet restore

  3. ASPNETCORE_ENVIRONMENT=Development dotnet run

  4. visit http://localhost:5000/Account/Register, enter data & press register

Expected behavior

The site should register the user & work without any issue

Actual behavior

An error occurred with these messages:

An unhandled exception occurred while processing the request.

NotSupportedException: The keyword 'integrated security' is not supported on this platform.
System.Data.SqlClient.SqlConnectionString..ctor(string connectionString)
....

Solved by changing the connection string to use SQL Server Security:

"DefaultConnection": "Server=localhost;Database=aspnet-MVCAuthSQL;Trusted_Connection=False;MultipleActiveResultSets=true;User Id=SA;Password=my-secret-password;"

I suggest changing the templates to use SQL Server Security on Linux distributions, or adding another connection string (and suggesting to use it in Startup.cs) or at least link to https://msdn.microsoft.com/en-us/library/jj653752(v=vs.110).aspx#sqlserver in Startup.cs

I spent many hours to find the solution (from 4 PM - 11 PM with some breaks!) and I think templates should work by default. Also, the default string seems to applicable for Windows so I believe it should be changed on other platforms.

Environment data

dotnet --info output:

.NET Command Line Tools (1.1.0-preview1-005051)

Product Information:
 Version:            1.1.0-preview1-005051
 Commit SHA-1 hash:  5e88564e56

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  17.04
 OS Platform: Linux
 RID:         ubuntu.16.10-x64
 Base Path:   /usr/share/dotnet/sdk/1.1.0-preview1-005051

Copied from original issue: dotnet/cli#7156

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
badersurcommented, Jul 18, 2017

Hello @mlorbetske and thanks for your reply 😃

After installing dotnet 1.1.0-preview1-005077, I feel it would be nice to introduce other arguments instead of -uld to choose one of the EF Core date providers.

If I run dotnet new mvc -h, I would like to see something like these instead of -uld:

  -dp|--data-provider   Entity Framework Core data provider (only applies to Individual auth type)

                        InMemory

                        SQLite

                        LocalDB                                         

                        MSSQL

                        MSSQLCompact

                        MySQL

                        Default: SQLite


  --server              The server to connect to (use with MSSQL or MySQL data providers)

                        string - Optional

                        Default: localhost


  --database            The name of the database (use with MSSQL or MySQL data providers)

                        string - Optional

                        Default: aspnet-Folder name-random text


  --user-id             User id to log in to the date provider (use with MSSQL or MySQL data providers)

                        string - Optional

                        Default: sa (for MSSQL) or root (for MySQL)


  --password            Password for the user id

                        string - Optional

                        Default: Empty string

This will reduce some time spent on looking for connection strings, nuget packages and Classes/methods… but it may give an impression that these are the only supported data providers!

I was hoping to have something similar to Laravel’s database configuration but I forgot that ASP.NET Core is an opt-in framework 😕

0reactions
mlorbetskecommented, Sep 22, 2017

This issue was moved to aspnet/templating#26

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use SQL Server security for connection strings on Linux ...
I suggest changing the templates to use SQL Server Security on Linux distributions, or adding another connection string (and suggesting to use ......
Read more >
Encrypting Connections to SQL Server on Linux
SQL Server on Linux uses TLS to encrypt data that's transmitted across a network between a client application and an instance of SQL...
Read more >
Use Active Directory authentication for SQL Server on Linux
This tutorial provides the configuration steps for Active Directory authentication for SQL Server on Linux.
Read more >
Authenticate from Linux to Windows SQL Server with pyodbc
My suggestion is to move away from Windows Authentication and use SQL authentication. Really there is no security difference, except that you ...
Read more >
How to protect database connection strings on production ...
I have a .NET Core app that is deployed on Ubuntu (using Kestrel behind Nginx). The app has a database connection string.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found