Search code examples
c#asp.netweb-configconnection-string

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


My ASP.Net application runs fine locally, but as soon as I deploy to Azure App Services it gives this error:

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

I have seen a similar issue here:

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

However I have tried all the suggestions and none of them work.

I have a few different connection string and am getting logging to the database on the EF one, so I assume this is not talking about my EF connection string.

I have two other connection strings so I assume it is one of those.

My connection strings are in this format:

<add name="DefaultConnection" connectionString="data source=myazureservice.database.windows.net;initial catalog=mydatabasename;persist security info=True;user id=username;password=complexpassword" providerName="System.Data.SqlClient" />

I have tried changing my password to something with no special characters and I am still getting the error.

I have also tried going onto the azure site scm.azurewebsites.net, where I can view the generated web config. I have then used this locally and it all works fine. I am totally lost at what to try next.

Please can anyone shed any light on how I can:

  1. Debug this? It doesn't happen locally so I can't see how I can replicate this
  2. Fix the issue if anyone has any ideas

Thanks very much in advance.


Solution

  • 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.