ConnectionString configSource not found when deploying to Azure

I protect my MVC5 project by moving connection strings from web.config to an external file and not checking it on the original control and not adding it to the project.

My web.config looks like

<configuration>
  <connectionStrings configSource="ConnectionStrings.config" />

This works great in development.

I have a website hosted on Azure WebSites and I manually defined connection strings in the configuration portal.

The problem is that when I publish to Azure, I get the error "Unable to open configSource file 'ConnectionStrings.config'."

Is there a way to override the Connection Strings element in the web.config file so that it does not try to find an external file? Is conversion possible in Web Transforms?

Thank you in advance for your help.

+4
2

RemoveAttributes web.config configSource Azure.

+3

, :

<connectionStrings>
<add name="Entities" connectionString="" providerName="System.Data.EntityClient" />
</connectionStrings>

EF, ; = "myConnection", ; connectionString = "" ;

azure → Config, Connection String, Name Entities for Value. EF.

Azure web.config , ; ?

... ... ConnectionStrings.config, commit push, (gitignore) commit ., , ; ., - Im , uve , .

+2

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


All Articles