简体   繁体   English

在应用程序配置文件中找不到名为“ KgSoftProContext”的连接字符串

[英]No connection string named 'KgSoftProContext' could be found in the application config file

I've added the DLL in my project database. 我已经在项目数据库中添加了DLL。 main sentence even though the connection in the config file add it to the project I'm getting this error. 主语句,即使配置文件中的连接将其添加到项目中,我也收到此错误。

Database dll App.Config file 数据库DLL App.Config文件

<configuration>
  <configSections>

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
  </startup>
</configuration>

Main Project app.config file 主项目的app.config文件

<connectionStrings>
    <add name="KgSoftProContext" connectionString="Data Source=KDRGNY\KDRGNY;Initial Catalog=KgSoftPro;Integrated Security=True;MultipleActiveResultSets=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

context file 上下文文件

 static KgSoftProContext()
        {
            Database.SetInitializer<KgSoftProContext>(null);
        }

        public KgSoftProContext()
            : base("name=KgSoftProContext")
        {
        }

it's been outta control I'm trying to do the problem completely. 我一直试图完全解决这个问题。 the problem is solved. 问题已经解决了。

将连接字符串部分复制到主项目中的.config文件中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 InvalidOperationException:在应用程序配置文件中找不到名为“PayMyRentEntities”的连接字符串 - InvalidOperationException: No connection string named 'PayMyRentEntities' could be found in the application config file 在应用程序配置文件中找不到名为“ CREntities”的连接字符串 - No connection string named 'CREntities' could be found in the application config file 在应用程序配置文件中找不到名为“thenameofmyconnection”的连接字符串 - No connection string named “thenameofmyconnection” could be found in the application config file 在应用程序配置文件中找不到名为“MyEntities”的连接字符串 - No connection string named 'MyEntities' could be found in the application config file '在应用程序配置文件中找不到名为'MyEntities'的连接字符串。' - 'No connection string named 'MyEntities' could be found in the application config file.' 在应用程序配置文件中找不到已命名的连接字符串 - No connection string named could be found in the application config file System.InvalidOperationException:在应用程序配置文件中找不到名为“ SALESDBEntities”的连接字符串 - System.InvalidOperationException: No connection string named 'SALESDBEntities' could be found in the application config file 具有EF6的C#插件-在应用程序配置文件中找不到名为“实体”的连接字符串 - C# addin with EF6 - No connection string named 'Entities' could be found in the application config file 使用EF6的WCF - 在应用程序配置文件中找不到名为“Entities”的连接字符串,[I SET IT] - WCF with EF6 - No connection string named 'Entities' could be found in the application config file , [I SET IT] 具有实体框架的ASP.NET Core 2,在应用程序配置文件中找不到名为“ ####”的连接字符串 - ASP.NET Core 2 with Entity Framework, showing no connection string named '####' could be found in the application config file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM