Azure SQL数据库连接异常(抛出System.Data.SqlClient.SqlException) [英] Azure SQL Database connection exception (System.Data.SqlClient.SqlException is thrown )
问题描述
我正在研究ASP.NET MVC项目,我从头开始.我只想在我的项目中使用Azure上托管的SQL数据库.
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):用户'myname'的登录失败.已为该会话分配跟踪ID"00dbcf81-35eb-4d92-b022-da1bca001e5f".需要帮助时,将此跟踪ID提供给客户支持.
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.
我做了什么:
- 我使用提供的一个Azure管理门户设置了web.config连接字符串.我直接复制并粘贴.
- 我在计算机上设置了防火墙-出站和入站都允许使用端口1433
- 在azure管理门户中,我将我的IP地址放入列表中.
- 我可以使用密码和用户名成功使用SQL Server Management Studio连接Azure数据库.一切正常.
- 我还设置了允许其他Windows Azure服务访问此服务器"
这是我的连接字符串:
<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.
非常感谢您的帮助.
谢谢.
推荐答案
最终.解决了.
请注意Azure门户提供的连接字符串.您必须去掉密码的括号.就是这样!
PAY ATTENTION to the connection string Azure portal provides. You have to remove the brackets for the password. THAT'S IT!
这篇关于Azure SQL数据库连接异常(抛出System.Data.SqlClient.SqlException)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!