我的连接字符串在本地主机上是
<connectionStrings>
<add name="DbModels"
connectionString="metadata=res://*/Models.DbModels.csdl|res://*/Models.DbModels.ssdl|res://*/Models.DbModels.msl;provider=System.Data.SqlClient;provider connection string="data source=(LocalDB)MSSQLLocalDB;attachdbfilename=C:UsersmccDocumentsconsultations.mdf;integrated security=True;connect timeout=30;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
而且它工作得很好。
但是当我将我的网站部署到 somee.com 并尝试更新web.config
中的连接字符串时,我无法让它工作
一些连接字符串是这样的:
workstation id=Consultations.mssql.somee.com;packet size=4096;user id=Samer_61122_SQLLogin_1;pwd=///;data source=Consultations.mssql.somee.com;persist security info=False;initial catalog=Consultations
我需要知道如何正确的连接字符串才能工作
在 somee.com 中创建数据库,站点将生成如下所示的连接字符串:
workstation id=xxxx.mssql.somee.com;packet size=4096;user id=yyyy_SQLLogin_1;pwd=zzzz;data source=xxxx.mssql.somee.com;persist security info=False;initial catalog=xxxx
对 EF 尝试如下:
metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=xxxx.mssql.somee.com;initial catalog=xxxx;persist security info=True;user id=yyyy_SQLLogin_1;password=zzzz;MultipleActiveResultSets=True;App=EntityFramework"