Format of the initialization string does not conform to specification starting at index 0. Scenario After you deploy an application using one-click publish, when you run a page that accesses the database you get the following error message: Format of the initialization string does not conform to specification starting at index 0. Possible Cause and Solution Open the Web.config file in the deployed site and check to see whether the connection string values begin with $(ReplacableToken_ , as in the following example: XML <connectionStrings> <add name="DefaultConnection" connectionString="$(ReplacableToken_DefaultConnection-Web.config Connection String_0)" providerName="System.Data.SqlServerCe.4.0" /> <add name="SchoolContext" connectionString="$(ReplacableToken_SchoolContext-Web.config Connection String_0)" providerName="System.Data.SqlServerCe.4.0" /> </connectionStrings> If the connection strings look like this example, edit the project file and add the following property to the PropertyGroup element that is for all build configurations: XML <AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings> Then redeploy the application.
Format of the initialization string does not conform to specification starting at index 0.
$(ReplacableToken_
<connectionStrings> <add name="DefaultConnection" connectionString="$(ReplacableToken_DefaultConnection-Web.config Connection String_0)" providerName="System.Data.SqlServerCe.4.0" /> <add name="SchoolContext" connectionString="$(ReplacableToken_SchoolContext-Web.config Connection String_0)" providerName="System.Data.SqlServerCe.4.0" /> </connectionStrings>
PropertyGroup
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)