Azure SQL Database connection exception (System.Data.SqlClient.SqlException is thrown )

▼魔方 西西 提交于 2019-12-08 05:18:45

问题


I'm working on an ASP.NET MVC project and I started from scratch. I just want to use the SQL database hosted on Azure in my project.

System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'myname'. This session has been assigned a tracing ID of '00dbcf81-35eb-4d92-b022-da1bca001e5f'. Provide this tracing ID to customer support when you need assistance.

What I did:

  1. I set up the web.config connection string using the one Azure Management Portal provided. I copied and pasted directly.
  2. I set up the firewall on my computer - both outbound and inbound with port 1433 allowed
  3. In azure management portal, I put my IP address in the list.
  4. I can use my password and username to connect the Azure db using SQL server management studio successfully. Everything works fine.
  5. I also set "Allow other Windows Azure services to access this server"

Here is my connection string:

<add name="DefaultConnection" connectionString="Server=tcp:myserver.database.windows.net;Database=aspnet-WebApplication1-20140927090028;User ID=myid;Password={mypsw};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" />

I checked all the posts here and didn't find much information useful.

Any help is greatly appreciated.

Thanks.


回答1:


FINALLY. Solved.

PAY ATTENTION to the connection string Azure portal provides. You have to remove the brackets for the password. THAT'S IT!




回答2:


Seems there is something wrong with the credentials given as stated below Double check your Username and Password carefully.

System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'myname'. This session has been assigned a tracing ID of '00dbcf81-35eb-4d92-b022-da1bca001e5f'. Provide this tracing ID to customer support when you need assistance.



来源:https://stackoverflow.com/questions/26209884/azure-sql-database-connection-exception-system-data-sqlclient-sqlexception-is-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!