0

I'm currently working on a .NET Core project. When I run the application on my local machine (Windows) I can connect to a SQL Server database using my windows credentials.

I am attempting to shift into using a devcontainer within Visual Studio Code, but when I run the same application in the container (Linux) I get an error:

An exception of type 'Microsoft.Data.SqlClient.SqlException' occurred in Microsoft.Data.SqlClient.dll but was not handled in user code:

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)

I'm not sure where to go from here. What did I miss?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
michael
  • 787
  • 2
  • 6
  • 12
  • Does this answer your question? [Why am I getting "Cannot Connect to Server - A network-related or instance-specific error"?](https://stackoverflow.com/questions/18060667/why-am-i-getting-cannot-connect-to-server-a-network-related-or-instance-speci) – Igor Mar 04 '20 at 16:49
  • @Igor: No. Like I said, from within windows (host) the code runs perfectly fine. Within my container (linux) something is not set up properly and it fails. – michael Mar 04 '20 at 17:04
  • 2
    You may need to use SQL authentication rather than Windows authentication. Windows authentication only works on the _same machine_ or machines joined to the _same domain or forest_. Putting code in a container effectively puts on a different machine or domain. – Joel Coehoorn Mar 04 '20 at 17:10

0 Answers0