如何修复错误::初始化字符串的格式不符合规范从索引0开始:: [英] How to fix error ::Format of the initialization string does not conform to specification starting at index 0::
问题描述
我失去了整整24小时一些愚蠢的连接字符串错误,我无法找到任何解决方案。
我看到有这样几个问题,我都试一遍好,但找不到解决办法。
我上传我的网站上GoDaddy的共享主机。
我可以从我Management Studio中访问此数据库。
我无法从我的网站访问此数据库。我得到以下错误:
I lost exactly 24 hours on some stupid connection string error and I can't find any solution.
I saw that there are few questions like this and I try them all but can't find solution.
I uploaded my site on godaddy shared host.
I can access this database from my management studio.
I can't access this database from my site. I get following error:
初始化字符串的格式不
符合规范开始于索引0
Format of the initialization string does not conform to specification starting at index 0
我的连接字符串中的的web.config 的,它看起来是这样的:
My connection string is in web.config and it looks like this:
<connectionStrings>
<add name="mcn" connectionString="Data Source=mydatabase.db.8706856.hostedresource.com; Initial Catalog=mydatabase; User ID=username; Password=xyz;" providerName="System.Data.SqlClient" />
</connectionStrings>
是什么导致这个错误?我不知道什么尝试了:(
我也试着写 ...数据源=(本地); ...
推荐答案
这可能有助于看到实际的连接字符串是什么。添加到Global.asax中:
It might help to see what the actual connection string is. Add to Global.asax:
throw new Exception(ConfigurationManager.ConnectionStrings["mcn"].ConnectionString);
如果实际的连接字符串 $(ReplacableToken_mcn-的Web.config连接STRING_0)
,这可以解释这个问题。
If the actual connection string is $(ReplacableToken_mcn-Web.config Connection String_0)
, that would explain the problem.
这篇关于如何修复错误::初始化字符串的格式不符合规范从索引0开始::的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!