webconfig中配置<connectionStrings></connectionStrings>如下:
<connectionStrings>
<add name="GoodPanEntities" connectionString="metadata=res://*/GoodPan.csdl|res://*/GoodPan.ssdl|res://*/GoodPan.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;initial catalog=数据库名;persist security info=True;
user id=用户;password=密码;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
配置后在本地运行正常,上传到服务器后出现错误,把data source=.\SQLEXPRESS;改成服务器ip运行正常。
<connectionStrings>
<add name="GoodPanEntities" connectionString="metadata=res://*/GoodPan.csdl|res://*/GoodPan.ssdl|res://*/GoodPan.msl;provider=System.Data.SqlClient;provider connection string="data source=服务器IP;initial catalog=数据库名;persist security info=True;
user id=用户;password=密码;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>