0

I am working on an ASP.NET project using the .Net Framework 4.8. When connecting to SQL using an alias name, I receive the following error.

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: 0 - Access is denied.)

Additionally, I have verified that my SQL alias configuration is correct, and the connection from SQL server management studio to SQL server appears to be successful.

Unfortunately, I am unable to connect to SQL server from Visual Studio 2019.

Thom A
  • 88,727
  • 11
  • 45
  • 75
Pooja K Bhatt
  • 979
  • 2
  • 10
  • 18
  • 1
    Does this answer your question? [Cannot Connect to Server - A network-related or instance-specific error](https://stackoverflow.com/questions/18060667/cannot-connect-to-server-a-network-related-or-instance-specific-error) – Thom A Apr 07 '22 at 14:21
  • I have checked all the steps mentioned in above link, but still facing same issue.Thanks! – Pooja K Bhatt Apr 07 '22 at 14:57
  • Please list all the steps you have taken, and please show your full connection string (sanitized if necessary). Is the server pingable by that name from the client? Is TCP and Remote Connections enabled? If it's a named instance are you using `Server Name=YourServer\InstanceName` in the connection string, and have you enabled SQL Server Browser (or set a static port)? If it's a default instance are you using `Server Name=YourServer`? Have you opened the firewall for `sqlservr.exe`? – Charlieface Apr 07 '22 at 15:23
  • My connection string is : Server=Warehouse;Failover Partner=WarehouseStandBy;Database=Warehouse;Min Pool Size=0;Max Pool Size=200;Connection Timeout=15;Application Name=WarehouseClientCreator;Trusted_Connection=Yes; I have verified in configuration manager as well, my sql alias is configured under Alias as well with tcp protocol. – Pooja K Bhatt Apr 07 '22 at 16:13
  • Be aware that in SQL Server (Version) Configuration Manager there are two sets of Client Aliases - one set for 32-bit processes, the other for 64-bit processes. Did you check the alias configuration in both places? – AlwaysLearning Apr 07 '22 at 21:05
  • Yes I have checked and correctly configured in both places. – Pooja K Bhatt Apr 08 '22 at 18:29
  • The "Access is denied" message suggests that a software firewall could be involved. Check in Windows Firewall with Advanced Security to see if you have Outbound Rules enabled, you may need to add a rule that allows the Visual Studio IDE to make outbound connections. Check any 3rd party antivirus software you have installed for similar restrictions. – AlwaysLearning Apr 08 '22 at 23:27

0 Answers0