2
votes

I have a web application in visual studio 2017 .NET framework 4.7.1 with identity, that connects to azure sql server database. I am getting an error after submitting login form. The exception message is: "Server name cannot be determined. It must appear as the first segment of the server's dns name (servername.database.windows.net). Some libraries do not send the server name, in which case the server name must be included as part of the user name (username@servername). In addition, if both formats are used, the server names must match."

The error is only in the web server (azure app service). When I run it locally (localhost) it works fine.

I did what error message suggests but, it did´nt work. I searched about this but, none of the suggestions or solutions I found have worked.

If I remove login stuff, application is able to connect and works so, the problem seems to be the connection string I use to connect to identity tables.

I have tried this connection strings in web.config but none of them have worked:

1. add name="DefaultConnection" connectionString="Server=tcp:myServer.database.windows.net,1433;Initial Catalog=myDatabase;Persist Security Info=False;User ID=myUser@myServer;Password=myPassword;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False" providerName="System.Data.SqlClient"

2. add name="DefaultConnection" connectionString="Data Source=myServer.database.windows.net;Initial Catalog=myDatabase;Integrated Security=False;User Id=myUser;Password=myPassword;MultipleActiveResultSets=True" providerName="System.Data.SqlClient"

1
Hi juan uribe,did the error solved now? if my answer helps, could you please accept it? Thanks and have a good day.Leon Yue
Hi @LeonYue, no, I am still facing this issue. I already had done all you suggest and I did it again but, it did not resolve my problem. I don´t know what else do i have to check.juan uribe

1 Answers

0
votes

First, did you set the Allow access to Azrue Service ON?

Please check your Azrue SQL Database firewall settings on portal:

enter image description here

Second, get the correct connection string: enter image description here

Others, please see: Troubleshooting connectivity issues with Microsoft Azure SQL Database. enter image description here

Hope this can helps.