我有一个.NET Framework 4.7.2 Web应用程序,该应用程序在2012R2 Server上使用EF6.2(实体框架),无需任何问题连接到本地SQL Server。现在,我正在尝试将同一应用程序连接到Azure SQL MI数据库(2019 Server),并且会遇到与ADAL相关的错误。具有Azure AD密码连接字符串字符串的控制台应用程序在同一台计算机上正常工作。此外,EF应用程序在2012年服务器上正常运行,它是2019年Azure Server VMS上的EF版本应用程序。任何解决此问题的指示都非常感谢。
这是连接字符串:
< add name =“ myentities” connectionsTring =“ metadata = res:// /entityframework.xxx.csdl| res:// /em>/em>/em>/em>/em>/em>/em>/em> xxxx.sssdl| rese :////* /entityframework.xxx.msl; Provider = System.Data.sqlClient; Provider Connection string string ='data Source = xxxx.xxxxx.database.database.windows.net; onirter catalog; intiral catalog = testdb; testdb; persist Security Info = true = true = true; user
这是错误:
Innerexception:System.AggregateException:发生一个或多个错误。 ---> System.AggregateException:发生一个或多个错误。 --->
Adalexception:请求已计时。在AdalnativeWrapper.AdalgetAccesstoken上
...
in
xxxxx \ source \ repos \ sampleef \ dataObjects \ entityframework \ xxxx.cs:行19
I have a .NET Framework 4.7.2 web app that is using EF6.2 (Entity Framework) on 2012R2 server, connecting to an on-prem SQL server without any issues. Now, I am trying to connect the same app to an Azure SQL MI database from an Azure VM (2019 server) and I get ADAL-related errors. A console application with an Azure AD Password connection string works fine on the same machine. Also, the EF app works fine on the 2012 server, it is the EF version app on the 2019 Azure server VMs that is having the issues. Any pointers in resolving this is really appreciated.
This is the connection string:
<add name="MyEntities" connectionString="metadata=res:///EntityFramework.XXX.csdl|res:///EntityFramework.XXXX.ssdl|res://*/EntityFramework.XXX.msl;provider=System.Data.SqlClient;provider connection string='data source=XXXX.XXXX.database.windows.net;initial catalog=testDB;persist security info=True;user [email protected];password=XXXX;authentication="Active Directory Password";MultipleActiveResultSets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />
This is the error:
InnerException: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. --->
AdalException: The request has timed out. at ADALNativeWrapper.ADALGetAccessToken
...
in
XXXXX\source\repos\SampleEF\DataObjects\EntityFramework\XXXX.cs:line 19
发布评论
评论(1)
此错误 adalexception:请求已计时。在AdalnativeWrapper.adalgetaccesstoken上“ 通常会发生,如果您的防火墙会阻止对Azure AD的访问或访问令牌的到期。
解决此问题,
参考:
c# - 实体框架超时 - 堆栈溢出 by n-ate
。 - 和adalgetAccesstoken-error-with-aad-connections/ba-p/368806“ rel =“ nofollow noreferrer”> timeout和aad connections aad Connections-microsoft技术社区。
访问代币过期的问题 - 纤维 - dotnet·github 。
This error AdalException: The request has timed out. at ADALNativeWrapper.ADALGetAccessToken" usually occurs, if access to azure ad is blocked by your firewall or expiration of access token.
To resolve this,
References :
c# - Entity Framework Timeouts - Stack Overflow by N-ate.
Timeout and ADALGetAccessToken Error with AAD connections - Microsoft Tech Community.
Access token expired Issue · Issue #1596 · AzureAD/azure-activedirectory-library-for-dotnet · GitHub.