1
我有一個Asp.net MVC5應用程序,並已發佈到Microsoft Azure
。我首先將我的.mdf
文件遷移到Sql Azure Databases
。 Azure Portal
中提供的數據庫連接字符串不起作用。ArgumentException:關鍵字不支持:'服務器'
[ArgumentException的:不支持關鍵字:'服務器']
我的連接字符串如下web.config
connectionString="
Server=tcp:dbprojectserver.database.windows.net,1433;
Initial Catalog=db_project;
Persist Security Info=False;
User [email protected];
Password=kenth&&123;
Encrypt=True;
TrustServerCertificate=False;
Connection Timeout=30;
"
我相信這樣有什麼不對的連接字符串。任何有關的幫助,高度讚賞。
編輯
從這裏SQL Server Connection Strings讀取和第一或型號第一連接字符串例如下面的EF Db的
<add name="ConnectionStringName"
providerName="System.Data.EntityClient"
connectionString="metadata=res://*/ ContextClass.csdl|res://*/ ContextClass.ssdl|res://*/ ContextClass.msl;provider=System.Data.SqlClient;provider connection string="Data Source=ServerName;Integrated Security=False;User Id=userid;Password=password;MultipleActiveResultSets=True"" />
這是我根據上面的例子
<add name="ProjectEntities" connectionString="metadata=res://*/ ProjectWeb.Models.User.csdl|res://*/ ProjectWeb.Models.User.ssdl|res://*/ ProjectWeb.Models.User.msl;provider=System.Data.SqlClient;provider connection string="Data Source=tcp:dbprojectserver.database.windows.net,1433;Integrated Security=False;User Id=user[email protected];Password=kenth$$123;MultipleActiveResultSets=True"
" providerName="System.Data.EntityClient"/>
使用的是什麼它說
關鍵字不支持「數據源」
你是怎麼得到這個ConectionString?這是真的由門戶網站提供嗎?因爲我查看了我自己的幾個樣本,只看到「Data Source =」...「,從來沒有Server =」「 –
@亨克,是的這是門戶網站提供的信息 –
@HenkHolterman有幾個關鍵字意思是一樣的 – juunas