Azure Web Sites connection string for EF not matched

I am deploying an ASP.NET web application for Azure websites.

The site uses the Entity Framework, and when I include the following in Web.config , it works fine:

 <connectionStrings> <add name="DataContext" connectionString="metadata=res://*/Models.WpsData.csdl|res://*/Models.WpsData.ssdl|res://*/Models.WpsData.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=XXXX;initial catalog=XXXX;persist security info=True;user id=XXXX;password=XXXX;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /> </connectionStrings> 

However, if this connection string is deleted and instead specified through the Azure Management Portal, an error occurs.

 Name: DataContext Value: metadata=res://*/Models.WpsData.csdl|res://*/Models.WpsData.ssdl|res://*/Models.WpsData.msl;provider=System.Data.SqlClient;provider connection string="data source=XXXX;initial catalog=XXXX;persist security info=True;user id=XXXX;password=XXXX;multipleactiveresultsets=True;application name=EntityFramework" Type: Custom 

This results in an error: A string named DataContext cannot be found in the application configuration file.

+6
source share
1 answer

See a similar question here .

Try leaving the connection string in the web.config file with some value (either some test connection string or some dummy value), for example.

 <connectionStrings> <add name="DataContext" connectionString="dummy" providerName="System.Data.EntityClient" /> </connectionStrings> 
+8
source

Source: https://habr.com/ru/post/954365/


All Articles