我开发了一个 asp.net 网站(使用 webforms),我使用 Entity Framework 进行数据库连接。在我的本地计算机上,一切正常。现在我尝试托管它,但遇到了问题。我已将我的文件复制到生产服务器并附加了我的 SQL Server 数据库并将我的连接字符串设置为:
<add name="ConnectionString"
connectionString="Data Source=SQL5003.Smarterasp.net;Initial Catalog=DB_9C4561_WFormBlog;User Id=DB_9C4561_WFormBlog_admin;Password=mydbpwd"
providerName="System.Data.EntityClient" />
但是当我测试我的网站时出现错误:
Keyword not supported: 'data source'
当我删除“数据源”时,它开始提示不支持“初始目录”关键字。
请帮帮我。您可以向我介绍可以帮助我完成的分步教程或 Material 。提前致谢!
最佳答案
试试下面的格式,我的数据库在 smarterasp.net 上,它运行良好
<connectionStrings>
<clear />
<add name="ConnectionString" connectionString="Persist Security Info=False;database=DB_9C4561_WFormBlog;server=SQL5003.Smarterasp.net;user id=DB_9C4561_WFormBlog_admin;password=mydbpwd;Current Language=English;Connection Timeout=60;" />
</connectionStrings>
关于c# - 在生产服务器中托管一个带有 Entity Framework 的数据库网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30137739/