I have installed SQL Sever Express on my system and built an app (Winforms) in visual studio by creating a database in my SQL Server.
Now my application is complete, I have to install my app on my client (4-5 pc) all or on the same LAN and after installation when the user is trying to connect to my database located in my system he is getting below error:
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
By searching online, I checked the following points:
SQLEXPRESS
in my SQL Server configuration manager, at the bottom TCP dynamic port was 12345 (filled with other number) and my TCP port was empty.SQLEXPRESS
in my SQL Server configuration manager, at the bottom TCP dynamic port was 12345 (filled with other number) and my TCP port was empty.After all this when I reinstall the app in my client system I am getting the same error again, so please guide me if I am missing anything. And how to deploy a Winforms application with a database can access in many computers?
This is my current connection string (in the data source I have purposefully changed my hostname to LENOVO for confidential reasons):
<connectionStrings>
<add name="dbcs"
connectionString="Data Source=LENOVO\SQLEXPRESS;Initial Catalog=SQCData;User ID=ABCDE;Password=*****;Integrated Security=false"
providerName="System.Data.SqlClient" />
</connectionStrings>
In SQL Server Configuration Manager set TCP port value to 1433 on the IP configuration you and cleanup TCP Dynamic Ports. It should be empty.
The other option is to configure firewall rule not for static port but for SQL Server process. But in this case you will also to create a rule for SQL Server Browser service (port 1434/tcp) and startup the service.
User contributions licensed under CC BY-SA 3.0