如何解决Azure“此版本的SQL Server不支持Windows登录”?

当我尝试连接到SQL Azure时,我收到以下错误消息。

此版本的SQL Server不支持Windows登录

我正在使用Azure连接字符串。 在开发时我正在运行SQL Server Express。 当我尝试从数据库中获取某些数据时,会抛出此特定错误。

我正在使用的上下文在using子句中运行,请参见下文

function List GetList(string dbContextName) { using (MyDbContext context = new MyDbContext) { return context.SomeTypes.ToList(); } } 

我们使用的是Entity Framework 4.2版,ASP.NET MVC 3和.NET 4.0。

我该如何解决这个问题?

我使用user / pass仍然收到错误消息。 但是,我将此添加到我的连接字符串中并且它有效。

 Trusted_Connection=False;Encrypt=True; 

 Integrated Security=False 

在连接字符串中。

其他人已经提到过Az,SQL Azure中只支持SQL Server身份validation。 您可以阅读有关SQL Azure的指南和限制的更多信息。 以及SQL Azure的安全准则和限制 。

您必须在MASTER数据库中自己创建LOGIN ,然后您需要在自定义Azure数据库中创建USER 。 另外,不要忘记执行sys.sp_addrolemember以向您的用户授予一些权限。

有关在SQL Azure中管理用户和登录的更多信息,请访问 此处 。

最后,您可以随时查看连接字符串的宝贵来源。

SQL Azure中不支持集成身份validation(即连接字符串中的SSPI)。 仅支持SQL身份validation(即连接字符串中的用户名和密码)

您可能使用了错误的连接字符串,这是适用于我的情况的连接字符串格式:

“ConnectionString”:“Server = tcp:xxxx.database.windows.net,1433; Database = xxx; User ID = xxx; Password = xxx; Encrypt = True; TrustServerCertificate = False; Connection Timeout = 30;”

 1.**Windows Authentication** is not supported in Azure so you should go with **SQL Server Authentication**. 2.When you use SQL server Authentication you should pass User Id(Login in SQL server) and Password(Password in SQL server). 3.User Id should contain space in between should not be like UserId. 4.Trusted_Connection should be false. The connection string in *appsettings.json* look like this: "ConnectionStrings": { "DBContext": "Server=ServerName;Database=DbName;User Id=loginName;Password=loginPassword;Trusted_Connection=false;MultipleActiveResultSets=true" }