Asp.Net Core on Mac OS X connect to SQL Server Linux Docker

asp.net-core docker entity-framework entity-framework-core sql-server

Question

I have completed set the sql server linux on docker.

microsoft/mssql-server-linux:2017-latest   "/opt/mssql/bin/sqls…"   5 days ago          Up 18 minutes                 0.0.0.0:1433->1433/tcp                                                                      sql.server

When I'm using SQL Operations Studio to connect to the server I able to connect it:

Server: localhost
Username: sa
Password: *********

but when I'm changing my default connection string on asp.net core default connection

"DefaultConnection": "Data Source=localhost;Initial Catalog=PandaMarket.Identity;User ID=sa;Password=*********"

I encounter this error message, when performing database update dotnet ef database update from the terminal.

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: TCP Provider, error: 35 - An internal exception was caught)

1
0
4/27/2018 4:33:52 PM

Popular Answer

Yeah. You need to connect to database in your application.json

I do it like this

 {
  "ConnectionStrings": {
    "DefaultConnection": "Data Source=127.0.0.1,1433;Initial Catalog=vchasno;User ID=sa;Password=Dontoretto23;"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "AllowedHosts": "*"
}
0
8/12/2018 4:59:28 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow