2016-09-17 30 views
1

我是EF和WebApi的noob,我已經在這個問題上好幾個小時了,我搜索了互聯網,所以對於解決方案,但他們中的任何一個固定我的情況
我有一個簡單的網站,使用實體框架和Web Api。問題是我無法建立與數據庫的連接,我不斷收到錯誤「初始化字符串的格式不符合從索引0開始的規範」。該網站仍然是本地的,數據庫也是本地的。如何解決「初始化字符串的格式不符合從索引0開始的規範」

錯誤顯示出來的GenericRepository的這一部分(這裏只改變名稱):

public GenericRepository(DoacoesContext db) 
    { 
     _db = db; 
     _dbSet = _db.Set<TEntity>(); 

     Console.WriteLine("Conexão: " + _db.Database.Connection.ConnectionString); //here 
    } 

這裏是我的連接字符串:

<connectionStrings> 
<add name="name" connectionString="Server=localhost;Database=example;Uid=root;Pwd=admin;" providerName="MySql.Data.MySqlClient" /> 

我一直在這裏已經(和一些其他帖子和網站):
Format of the initialization string does not conform to specification starting at index 0
How to fix error ::Format of the initialization string does not conform to specification starting at index 0::

這裏是XML的錯誤(在服務器響應):

https://i.gyazo.com/19960b18f293187c269936cae7f2d360.png

已進行修正任何線索?如果需要,我可以顯示更多代碼。

在此先感謝!

回答

相關問題