EF6 Connection String in Azure

偶尔善良 提交于 2019-12-05 04:25:43
Chad Richardson

The portal doesn't have the capabilities to accept the providerName attribute. As such, you need to keep the connection string in your web.config, which specifies the name and the providerName but just put in a dummy value for the connection string. Now put that connection string value in the portal connection string. When it runs, it will pick up the providerName from the web.config, but then overwrite your dummy connection string that is in the web.config with the connection string value you put in Azure portal Application Settings [Connection Strings]. See SQL Azure EF Database First Connection String in Azure Management Portal

Your missing the Provider Name on your Web.Config file. There are three attributes on your ConnectionStrings Add Element, Name, ConnectionString and ProviderName. Your are missing the ProviderName attribute on the Add Element. I spread out the attributes to show them clearly, Just add providerName="System.Data.EntityClient" after your connectionString attribute and you should be good to go !

 <connectionStrings>
        <add 

       name="XXXXXXContainer" 

       connectionString="metadata=res://*/XXXXXX.csdl|res://*/XXXXXX.ssdl|res://*/XXXXXX.msl;
       provider=System.Data.SqlClient;
       provider connection string=&quot;
       data source=chibitestdbserver.database.windows.net;
       initial catalog=XXXXXX;
       persist security info=True;
       user id=chibionos;
       password=XXXXXXXX;
       MultipleActiveResultSets=True;
       App=EntityFramework&quot;" 

      providerName="System.Data.EntityClient" />
      </connectionStrings>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!