Last post Sep 24, 2014 04:08 AM by Shawn - MSFT
Sep 23, 2014 12:52 AM|baboso#4|LINK
I have a Web MVC app talking to a MySQL server. The application uses the Identity Model that is auto-generated by Visual Studio (2013 express). And it also uses my dbContext connection string. My dbContext is working fine when exchanging data with MySQL.
However, while using the identity model, when I try to register a user. I get the error: "Format of the initialization string does not conform to specification starting at index 0." It fails at the following code:
var result = await UserManager.CreateAsync(user, model.Password);
Would like to know if anyone knows what the solution is for this.
Sep 23, 2014 03:56 PM|baboso#4|LINK
There seems to be a bug in Visual Studio as far as collation is concerned when dealing with MySQL.
With my web.config pointing to MySQL server, the default identity context tries to create the aspnet db with a MS SQL format perhaps requiring two bytes while MySQL uses utf8 which is one byte.
1- Using code first, if there is not a connectionstring in web.config, you'll get this error "Format of the initialization string does not conform to specification starting at index 0".
2- If you add a connection string to web.config for aspnet then you get this error when registering a user: "Specified key was too long; max key length is 767 bytes", but it will still create the aspnet db. In order to get past this, you have to change
the collation for aspnet in MySQL to utf16. Then you can register users at will.
2- If you change the MySQL server collation to utf16 so you won't have this error at the beginning, then you get this error when registering a user: Variable 'character_set_client' can't be set to the value of 'utf16'
It looks like no matter what you do, you are stuck, and the only alternative is to change collation for aspnet to utf16 after it has been created.
Sep 24, 2014 04:08 AM|Shawn - MSFT|LINK
I get the error: "Format of the initialization string does not conform to specification starting at index 0." It fails at the following code:
For this situation, it seems that there is something wrong with your connection string. So, you should make sure that the connection string to your sql server:
The server/instance name syntax used in the server option is the same for all SQL Server connection strings.
And for more information, you could refer to: