将Connectionstring更改为Azure

时间:2017-03-24 12:56:30

标签: asp.net azure telerik connection-string sqlclient

我正在将连接字符串从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=&quot;data source=tcp:xxx,1433;Initial Catalog=xxx;integrated security=False;user     
id=xxx;password=xxx;MultipleActiveResultSets=True;App=EntityFramework&quot;"  />        
</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;
}

0 个答案:

没有答案