I followed every instruction to publish and deploy my project into AZURE my web-app from Visual Studio and my SQL database from Microsoft SQL server management. It shows successful for everything and the web-app runs. The following error shows whenever any interaction happens with the database:
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)?.
However, I did reconfigure the Connection string in the web-app before publishing it and the problem still showing. here is the connection string that I am using. and I got it from Azure using the same name of the database as it mentions.
Server=tcp:apuldb.database.windows.net,1433;Initial Catalog=apuldb;Persist Security Info=False;User ID=*****;Password=*****;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
Update: the app fully works via the above connection string only when I run it from Visual Studio locally. So, the app can be connected successfully to the online database in the cloud if I run it locally using AZURE database.