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

I have uploaded a new website on server, but when i try to run it on web-browser i am getting this error

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

What is the cause of issue & how to resolve it? I didn't got this error before


Asked by:- manish
: 9744 At:- 8/9/2017 7:31:23 AM
C# web-config format-of-string

3 Answers
profileImage Answered by:- vikas_jk

You need to check your connection string in Web.Config File, basically it is throwing an error because of connection string format is not correct.

SQL Server Connection string formats

Standard Security

Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;

Trusted Connection


Connection to a SQL Server instance

The server/instance name syntax used in the server option is the same for all SQL Server connection strings.

Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;

It should resolve your issue.

Or Check if You are updating the database using Code-first(Update-Database command ) if you have selected the correct project(Entity framework project) in NuGet package manager console or not, if not Nuget may be looking in at the web.config file of that startup or any other project.


Try checking your Program.cs (.NET Core 6) to have DbConnectionString Syntax as below

builder.Services.AddDbContext<MyDbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));

I was getting this error, since I forgot to get connection string properly using above command.

At:- 8/9/2017 7:42:07 AM Updated at:- 10/26/2022 11:52:27 AM
Good answer, thanks, i see there was an issue with my connection string, which is resolved now 0
By : manish - at :- 8/18/2017 12:19:47 PM

profileImage Answered by:- pika

Above answer looks good, this error occurs basically because of connection string issue.

If your password contains charatcers like ";'" etc, then add quotes before and after password in connection string, example

<add name="defaultconnection" connectionString="server=local;database=dbanme;user id=userID;password='pass;word'" providerName="System.Data.SqlClient" />

If you are getting this error in ASP.NET Core, you can correct add connection string details in Startup.cs ->  ConfigureServices

services.AddDbContext<dbsContext>(options => options.UseSqlServer(Configuration.GetConnectionString("Default")));


At:- 10/17/2021 4:05:51 PM

profileImage Answered by:- jaiprakash

If your password contains special characters like ';' then you may need to update your connection string as below

<add name="db" connectionString="server=YourServerName;database=DBName;user id=dbuser;password='pass;word'" providerName="System.Data.SqlClient" />

Note: Above password is enclosed between single quotes (') inside connection string.

At:- 11/15/2022 2:57:28 PM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use