I built a C# console app that connects to a SQL Server database. Locally it's working perfectly, but when I publish it to a network shared folder, I get this error:
Unhandled exception. System.Data.SqlClient.SqlException (0x80131904): 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
System.ComponentModel.Win32Exception (5): Access denied.
The connection string used :
SqlConnection conn = new SqlConnection("Data Source=frpardb9354;Initial Catalog=" + database_source + ";Integrated Security=SSPI");
I tried using Integrated security=False
and hardcoding the user ID and password, it didn't work.
I also verified that connection mode is Windows auth and SQL Server in SSMS, and that the server allows remote connection.
Anybody has an idea of the source of this error?