Monday, 24 February 2014

Web.config changing when publishing application - how to avoid it?

I have MVC website, that I deployed to Azure. The application uses EF Code First. 

After deployment, these lines were added to web.config:

    <add name="LoremIpsum.LoremContext" 
         providerName="System.Data.SqlClient" />

This caused this error:

Format of the initialization string does not conform to specification starting at index 0.

I solved this by going to my Publish Profile (the .pubxml file) and deleted following lines:

    <MSDeployParameterValue Include="$(DeployParameterPrefix)LoremIpsum.LoremContext-Web.config Connection String">
      <ParameterValue>... my actual connection string ...</ParameterValue>
    <_ConnectionStringsToInsert Include="LoremIpsum.LoremContext" />

No comments:

Post a Comment