C# 无法加载文件或程序集';BookMe';或者它的一个依赖项

C# 无法加载文件或程序集';BookMe';或者它的一个依赖项,c#,asp.net,entity-framework,C#,Asp.net,Entity Framework,我对项目有问题。每次我创建使用EntityFramework的项目时,我都会遇到这个问题 存在程序集跟踪: === Pre-bind state information === LOG: DisplayName = BookMe (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: BookMe | Domain ID: 2 WRN: A partial bind

我对项目有问题。每次我创建使用EntityFramework的项目时,我都会遇到这个问题

存在程序集跟踪:

=== Pre-bind state information ===
LOG: DisplayName = BookMe
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: BookMe | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/mscib/Documents/GitHub/BookMe/BookMe.WebUI/
LOG: Initial PrivatePath = C:\Users\mscib\Documents\GitHub\BookMe\BookMe.WebUI\bin
Calling assembly : EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\mscib\Documents\GitHub\BookMe\BookMe.WebUI\web.config
LOG: Using host configuration file: C:\Users\mscib\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/ea956ac0/519f841f/BookMe.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/ea956ac0/519f841f/BookMe/BookMe.DLL.
LOG: Attempting download of new URL file:///C:/Users/mscib/Documents/GitHub/BookMe/BookMe.WebUI/bin/BookMe.DLL.
LOG: Attempting download of new URL file:///C:/Users/mscib/Documents/GitHub/BookMe/BookMe.WebUI/bin/BookMe/BookMe.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/ea956ac0/519f841f/BookMe.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/ea956ac0/519f841f/BookMe/BookMe.EXE.
LOG: Attempting download of new URL file:///C:/Users/mscib/Documents/GitHub/BookMe/BookMe.WebUI/bin/BookMe.EXE.
LOG: Attempting download of new URL file:///C:/Users/mscib/Documents/GitHub/BookMe/BookMe.WebUI/bin/BookMe/BookMe.EXE.
堆栈跟踪:

[FileNotFoundException: Could not load file or assembly 'BookMe' or one of its dependencies. Nie można odnaleźć określonego pliku.]
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +95
   System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +53
   System.Type.GetType(String typeName, Boolean throwOnError) +43
   System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(Type requiredContextType, String contextTypeName, String initializerTypeName, Boolean isDisabled, Func`1 initializerArgs, Func`3 exceptionMessage) +46

[InvalidOperationException: Failed to set database initializer of type 'BookMe.Domain.Concrete.BookMeInitializer, BookMe' for DbContext type 'BookMe.Domain.Concrete.BookMeContext, BookMe' specified in the application configuration. See inner exception for details.]
   System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(Type requiredContextType, String contextTypeName, String initializerTypeName, Boolean isDisabled, Func`1 initializerArgs, Func`3 exceptionMessage) +314
   System.Data.Entity.Internal.<>c__DisplayClass6.<TryGetInitializerFromEntityFrameworkSection>b__1(ContextElement e) +255
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +223
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +115
   System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(Type contextType) +23
   System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name) +511
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +84
   System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key) +175
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +75
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +115
   System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key) +38
   System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +169
   System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +174
   System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +269
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +38
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +77
   System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +21
   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +83
   ASP._Page_Views_Test_Index_cshtml.Execute() in C:\Users\mscib\Documents\GitHub\BookMe\BookMe.WebUI\Views\Test\Index.cshtml:8
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +88
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +107
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +831
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +43
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +607
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134
[FileNotFoundException:无法加载文件或程序集“BookMe”或其依赖项之一。Nie można odnaleźćokreślonego pliku。]
System.RuntimeTypeHandle.GetTypeByName(字符串名称、Boolean throwOnError、Boolean ignoreCase、Boolean reflectionOnly、StackScrawlMarkHandle stackMark、IntPtr pPrivHostBinder、Boolean loadTypeFromPartialName、ObjectHandleOnStack类型)+0
System.RuntimeTypeHandle.GetTypeByName(字符串名称、布尔throwOnError、布尔ignoreCase、布尔reflectionOnly、StackScrawlMark和stackMark、IntPtr pPrivHostBinder、布尔loadTypeFromPartialName)+95
System.RuntimeType.GetType(字符串typeName、布尔throwOnError、布尔ignoreCase、布尔reflectionOnly、StackScrawlMark和stackMark)+53
System.Type.GetType(字符串类型名,布尔错误)+43
System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(类型requiredContextType、字符串contextTypeName、字符串initializerTypeName、布尔值isDisabled、Func`1 initializerArgs、Func`3 exceptionMessage)+46
[InvalidOperationException:未能为应用程序配置中指定的DbContext类型“BookMe.Domain.Concrete.BookMeContext,BookMe”设置类型为“BookMe.Domain.Concrete.BookMeInitializer,BookMe”的数据库初始值设定项。有关详细信息,请参阅内部异常。]
System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(类型requiredContextType、字符串contextTypeName、字符串initializerTypeName、布尔值isDisabled、Func`1 initializerArgs、Func`3 exceptionMessage)+314
System.Data.Entity.Internal.c__uDisplayClass6.b__u1(ContextElement e)+255
System.Linq.whereSelectEnumerableInterator`2.MoveNext()+223
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1源,Func`2谓词)+115
System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(类型contextType)+23
System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(类型、字符串名称)+511
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey,Func`2 valueFactory)+84
System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(类型,对象键)+175
System.Linq.WhereSelectArrayIterator`2.MoveNext()+75
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1源,Func`2谓词)+115
System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(类型,对象键)+38
System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()+169
System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput输入)+174
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 Action)+269
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(类型entityType)+38
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()+77
System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()+21
System.Linq.WhereSelectEnumerableIterator`2.MoveNext()+83
C:\Users\mscib\Documents\GitHub\BookMe\BookMe.WebUI\Views\Test\Index.cshtml:8中的ASP
System.Web.WebPages.WebPageBase.ExecutePageHierarchy()+252
System.Web.Mvc.WebViewPage.ExecutePageHierarchy()+148
System.Web.WebPages.StartPage.ExecutePageHierarchy()+88
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext-pageContext,TextWriter-writer,WebPageRenderingBase-startPage)+107
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext上下文)+375
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1过滤器、Int32过滤器索引、ResultExecutingContext预文本、ControllerContext ControllerContext、ActionResult ActionResult)+88
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1过滤器、Int32过滤器索引、ResultExecutingContext预文本、ControllerContext ControllerContext、ActionResult ActionResult)+831
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext ControllerContext,IList`1过滤器,ActionResult ActionResult)+81
System.Web.Mvc.Async.c__显示类21.b__1e(IAsyncResult asyncResult)+185
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)+38
System.Web.Mvc.Controller.b_u1d(IAsyncResult asyncResult,ExecuteCorerate innerState)+29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)+65
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)+52
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)+36
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)+38
System.Web.Mvc.MvcHandler.b_uu5(IAsyncResult asyncResult,ProcessRequestState innerState)+43
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)+65
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)+38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+607
System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)+134
我试过各种解决办法。我将premision改为临时Asp Net,并将其删除。我检查了集合。我不知道我能做什么

谢谢你的帮助, 姆西博斯基

编辑: 我的解决方案包含3个项目: 域、WebUI、单元测试。WebUI设置为启动项目,存在web.config:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="BookMeDb" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=BookMe1;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.6" />
    <httpRuntime targetFramework="4.6" />
    <globalization uiCulture="en-US"/>
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers>
  </system.codedom>
  <entityFramework>
    <contexts>
      <context type="BookMe.Domain.Concrete.BookMeContext, BookMe">
        <databaseInitializer type="BookMe.Domain.Concrete.BookMeInitializer, BookMe" />
      </context>
    </contexts>
    <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>
</configuration>


您必须更新EntityFramework配置以指定正确的程序集名称。您必须使用type=“BookMe.Domain.Concrete.BookMeContext,BookMe”,而不是type=“BookMe.Domain.Concrete.BookMeContext,BookMe.Domai
<entityFramework>
    <contexts>
      <context type="BookMe.Domain.Concrete.BookMeContext, BookMe.Domain">
        <databaseInitializer type="BookMe.Domain.Concrete.BookMeInitializer, BookMe.Domain" />
      </context>
    </contexts>
    <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>
type="Fully.Qualified.TypeName, AssemblyName"