原文地址:http://www.cnblogs.com/TomXu/archive/2011/11/25/2263225.html
Format of the initialization string does not conform to specification starting at index 0
场景
使用one-click发布以后,访问页面(需要读取数据库)的时候出现如下错误:
Format of the initialization string does not conform to specification starting at index 0.
产生原因和解决方案
打开部署站点的Web.config文件,看看数据库连接字符串是不是以$(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>