首页 > 解决方案 > 实体框架和 ApplicationIntent=READONLY

问题描述

我首先在 ASP.NET Framework v4.6.2 应用程序中使用 Entity Framework v6.4.4 数据库。这是我在 web.config 中的连接字符串条目:

<add name="MyApplicationEntities" connectionString="metadata=res://*/Models.MyApplication.csdl|res://*/Models.MyApplication.ssdl|res://*/Models.MyApplication.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=*****;MultiSubnetFailover=True;initial catalog=****;persist security info=True;ApplicationIntent=READONLY;user id=****;password=****;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

如果 ApplicationIntent=READONLY 在连接字符串中,那么当我尝试访问数据库时会出现异常:

The underlying provider failed on Open --> The wait operation timed out.

否则一切都很好。

我已经看到了这个答案 - https://stackoverflow.com/a/21241299/1471850 - 但这没有帮助。有谁知道问题可能是什么?

标签: asp.netsql-serverentity-frameworkhigh-availability

解决方案


推荐阅读