1110 1110 - 3 months ago 177
ASP.NET (C#) Question

How to fix error ::Format of the initialization string does not conform to specification starting at index 0::

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:


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


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>


What cause this error? I have also tried to write
...Data Source=(local);...

Answer

It might help to see what the actual connection string is. Add to Global.asax:

throw new Exception(ConfigurationManager.ConnectionStrings["mcn"].ConnectionString);

If the actual connection string is $(ReplacableToken_mcn-Web.config Connection String_0), that would explain the problem.

Comments