Format of the initialization string does not conform to specification starting at index 0
Check your connection string. If you need help with it check Connection Strings, which has a list of commonly used ones.
Commonly used Connection Strings:
SQL Server 2012
Standard Security
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
Trusted Connection
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
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;
Password=myPassword;
SQL Server 2005
Standard Security
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
Trusted Connection
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
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;Password=myPassword;
MySQL
Standard
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Specifying TCP port
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Oracle
Using TNS
Data Source=TORCL;User Id=myUsername;Password=myPassword;
Using integrated security
Data Source=TORCL;Integrated Security=SSPI;
Using ODP.NET without tnsnames.ora
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;
Format of the initialization string does not conform to specification starting at index 0.
Format of the initialization string does not conform to specification starting at index 0. is just an ArgumentException message from giving a bad connection string to the SqlConnection(string)
constructor: give it a valid SQL Server connection string (i.e. not "ConnectionString"
), and you will be ready to move on to tackling the other issues in your code.
For reference, you can see how I quickly, minimally morphed your code to confirm the source of given error message in LINQPad 4:
Format of the initialization string does not conform to specification starting at index 103
I've managed to finally get it working.
There was nothing wrong with my connection string with regards to credentials, for some reason it was because I had two connection strings with the same setttings.
I merged them into one and it then started working suddenly. Strange but I hope this may help someone out.
Format of the initialization string does not conform to specification starting at index 0
The permissions on the SQL server were not correctly set up. I have now resolved this by properly setting up the server permissions.
Error : Format of the initialization string does not conform to specification starting at index 0. when trying to invoke the function app
Presuming the connection string worked when you used it directly in the app settings I would check out this link
https://learn.microsoft.com/en-us/azure/app-service/app-service-key-vault-references
So in your example you would use
@Microsoft.KeyVault(SecretUri=https://srlcustomermanagervault.vault.azure.net/secrets/ConnectionString
)
The documentation says you need the version id but you do not, (it is a bug that it works). Azure is working on a release so that it works without a version which should probably be out in preview by now and if not shortly. I have talked with several people and have it working for a client without the version.
Format of the initialization string does not conform to specification starting at index 227
Your connection string seems to have extra quotation marks ("
) inside its DataSource
description, and also, just before it, it appears to have an extra CentralDb
at the beginning of the provider connection string
.
Try this instead:
<add name="CentralDb" connectionString=
"metadata=.\CentralDb.csdl|.\CentralDb.ssdl|.\CentralDb.msl;
provider=System.Data.SqlClient;
provider connection string="Data Source=U19675709\SQLEXPRESS;Initial Catalog=CentralDb;Integrated Security=True;MultipleActiveResultSets=False""
providerName="System.Data.EntityClient" />
Related Topics
Why Doesn't 'Ref' and 'Out' Support Polymorphism
How to Read ASP.NET Core Response.Body
How to Hide Only the Close (X) Button
How to Stop Entity Framework from Trying to Save/Insert Child Objects
Access to Modified Closure (2)
What Is the Simplest Way to Get Indented Xml with Line Breaks from Xmldocument
Should I Call Close() or Dispose() for Stream Objects
Replace First Occurrence of Pattern in a String
Deserialize Xml to Object Using Dynamic
"A Lambda Expression with a Statement Body Cannot Be Converted to an Expression Tree"
Embedding an External Executable Inside a C# Program
Converting Bitmapimage to Bitmap and Vice Versa
Starting Tasks in Foreach Loop Uses Value of Last Item
How to Get the Currently-Logged Username from a Windows Service in .Net