【问题标题】:The specified named connection is either not found in the configuration在配置中找不到指定的命名连接
【发布时间】:2015-06-22 20:41:56
【问题描述】:

正如标题所说,我在使用应用程序连接数据库时遇到问题。

这是我遇到的错误

在配置中找不到指定的命名连接,不打算与 EntityClient 提供程序一起使用,或者无效。

这是它的代码:

        public SaleswebEntities() : base("name=SaleswebEntities", "SaleswebEntities")
    {
        this.ContextOptions.LazyLoadingEnabled = true;
        OnContextCreated();
    }

这是我的连接字符串。

  <connectionStrings>
<add name="SaleswebEntities" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Salesweb;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
  providerName="System.Data.SqlClient" />

据我所知,我没有错字,值得一提的是这是一个 MVC2 应用程序。

【问题讨论】:

    标签: c# mysql asp.net-mvc-2


    【解决方案1】:

    您使用的是 DSN 吗? http://www.connectionstrings.com/dsn/:

    到这里:%windir%\system32\odbcad32.exe 和/或 C:\Windows\SysWOW64\odbcad32.exe 添加...

    【讨论】:

    • 不,我没有使用 DSN
    • 如果我被这样卡住,我会尝试不同的方法,例如添加/使用 DSN。祝你好运。
    猜你喜欢
    • 2016-04-06
    • 1970-01-01
    • 2012-01-30
    • 1970-01-01
    • 2015-07-17
    • 2012-11-25
    • 1970-01-01
    相关资源
    最近更新 更多