【问题标题】:ASP.NET MVC Connection StringASP.NET MVC 连接字符串
【发布时间】:2017-10-12 20:55:31
【问题描述】:

我的网站,一个 ASP.NET MVC 应用程序,在 Visual Studio 中与数据库实体等完美运行。我想尝试将我的应用程序上传到 GoDaddy 的 Plesk Web 服务。

我在这里得到了一个指南: http://www.c-sharpcorner.com/article/how-to-host-your-asp-net-mvc-website-on-godaddy-server/

在第 19 步说:“为您的服务器端数据库编写连接字符串。” 并在第 20 步“再次打开 Visual Studio 并从包管理器更新数据库,再次在 Visual Studio 的项目的 web.config 中写入相同的连接字符串。打开包管理器控制台并键入以下命令,”

谁能给我一些建议,连接字符串是什么意思?

【问题讨论】:

  • 它位于 Web.config 中,您只需要在 GoDaddy 上为删除服务器更新正确的值,例如服务器的 IP 地址、用户、密码和数据库名称
  • 包管理器控制台在Tools/NuGet Package Manager/Package Manager Console
  • 在配置文件中插入连接字符串的位置是<configuration><appSettings>......blah, blah..</appSettings><connectionStrings><add name="myConnection" connectionString = "Data Source=xxx.......blah, blah"/></connectionStrings></configuration>
  • web.config 中没有连接字符串。

标签: c# asp.net connection-string


【解决方案1】:

web.config 文件中有连接字符串。 我正在使用实体框架,所以我的连接字符串如下

add name="yourEntityName" connectionString="metadata=res:///entity.csdl|res:///entity.ssdl|res:/ /*/entity.msl;provider=System.Data.SqlClient;provider connection string="data source=yourServerIpAddress;****initial catalog=DataBaseName;persist security info=True;用户 id=YourId;password=YourPassword;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />

您必须更改连接字符串中的行,其中我的 conn 中的粗线。字符串。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-06
    • 1970-01-01
    • 2015-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多