我正在将连接字符串从MSSQL更改为Azure SQL,然后出现此错误。已经将ProviderName提供给System.Data.SqlClient
但仍然收到错误。
错误:
ProviderName conflicts with backend setting 'MsSql'.
Parameter name: providerName
Actual value was System.Data.SqlClient.
实际上是连接线:
<connectionStrings>
<add name="CONNECTION_STRING"
providerName="System.Data.SqlClient"
connectionString="Data Source=tcp:xxx.net,1433;Initial Catalog=xxx;Integrated Security=False;User ID=xx;Password=xxx;" />
<add name="XXXEntities"
providerName="System.Data.EntityClient"
connectionString="metadata=res://*/GnModel.csdl|res://*/GnModel.ssdl|res://*/GnModel.msl;provider=System.Data.SqlClient;provider connection string="data source=tcp:xxx,1433;Initial Catalog=xxx;integrated security=False;user
id=xxx;password=xxx;MultipleActiveResultSets=True;App=EntityFramework"" />
</connectionStrings>
我找到了这段代码。实际上它是通过telerik开放访问在Auto生成的类中。
public static BackendConfiguration GetBackendConfiguration()
{
BackendConfiguration backend = new BackendConfiguration();
backend.Backend = "MsSql";
backend.ProviderName = "System.Data.SqlClient";
backend.Logging.MetricStoreSnapshotInterval = 0;
backend.ConnectionPool.ActiveConnectionTimeout = 300;
CustomizeBackendConfiguration(ref backend);
return backend;
}