c# - 在生产服务器中托管一个带有 Entity Framework 的数据库网站

标签 c# asp.net entity-framework

我开发了一个 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/

相关文章:

c# - 如何在 Visual Studio 2019 中连接到 MySQL 数据源?

c# - 从 C# 驱动程序更新字段

c# - 是否可以反转 c# 命名空间的别名?

c# - 检查依赖项是否已正确解析 IOC

c# - 是否只有在条件为真时才从函数返回的单行语句?

asp.net - 您使用什么工具来提高编码效率和整体效率

javascript - 如何做这种确认对话框?

asp.net - 如何仅使用 CSS 在 GridView 行中显示鼠标悬停效果?

c# - 使用 ENTity Framework 查询填充 DTO 类 List<>

mysql - Entity Framework MySql : DbGeometry not read from the DB