Hi Team
I want to see if it possible to on web.config, does it allow if i have production db cluser the connection string so i dont get this error often below.
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).
Vishal JoshiPosted Mar 7, 2024, 11:51 AM
Hello,
Connection string is properly configured to connect to the production database cluster.
As in your connection string username and password looks missing. please try to add it and try,
Also you need to check SQL Server settings and firewall setting. please find below steps to review it.
Configure SQL Server to accept remote connections:
a. Open SQL Server Management Studio (SSMS) and connect to your SQL Server instance.
b. Right-click on the server instance in Object Explorer and select "Properties".
c. Go to the "Connections" tab.
d. Check the option "Allow remote connections to this server".
e. Click "OK" to save the changes.
Adjust Firewall Settings:
a. If Windows Firewall is enabled, you need to create an inbound rule to allow SQL Server traffic on the appropriate port. By default, SQL Server uses TCP port 1433 for connections, but this may vary depending on your SQL Server configuration.
b. Open Windows Defender Firewall with Advanced Security.
c. Click on "Inbound Rules" on the left pane.
d. Click on "New Rule" on the right pane.
e. Select "Port" and click "Next".
f. Choose "TCP" and specify the port number used by your SQL Server instance (e.g., 1433).
g. Select "Allow the connection" and click "Next".
h. Choose the appropriate network location and click "Next".
i. Enter a name for the rule (e.g., SQL Server) and click "Finish".
Restart SQL Server Service: After making these changes, it's a good practice to restart the SQL Server service to apply the configuration changes.
Once these steps are completed, your SQL Server instance should be configured to accept remote connections. Make sure to test the remote connection from a client application or SQL Server Management Studio installed on a different machine to ensure everything is working as expected. Additionally, always ensure that you follow security best practices, such as using strong passwords, implementing encryption, and restricting access to authorized users, to protect your SQL Server instance from unauthorized access.
Thanks
Vishal Joshi
Jayraj ChhayaPosted Mar 7, 2024, 11:21 AM
You need to ensure that the database server is configured to allow remote connections. The error you are encountering is likely due to network or instance-specific issues.
In the connection string within the web.config file, ensure that the Data Source points to the correct server and that the SQL Server is set up to accept remote connections. You may need to modify the connection string to include the server's IP address or hostname instead of relying on local server references.
Additionally, verify that the SQL Server instance is configured to allow remote connections by enabling TCP/IP protocol and opening the necessary ports in the firewall.
By correctly configuring the connection string and ensuring the SQL Server settings permit remote access, you can mitigate the error and establish a successful connection to the production database cluster.