无法从程序集中加载“Project.DAL.Conext”类型

时间:2016-04-11 01:29:12

标签: c# asp.net-mvc entity-framework

我一直在努力想出这个,开启和关闭,现在几天,我已经检查了其他答案,我似乎无法找到解决方案。我已经提供了堆栈跟踪的前半部分,但是如果需要更多信息请告诉我(不希望这是一个5页的帖子)。

WheresTheSpaceship
PrintLocation

我在web.config上尝试了一些不同的方法,我已经仔细检查了上下文,可能是为什么我这么难过

Could not load type 'eFormsRedux.DAL.FDCConext' from assembly 'eFormsRedux'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about  the error and where it originated in the code. 

Exception Details: System.TypeLoadException: Could not load type 'eFormsRedux.DAL.FDCConext' from assembly 'eFormsRedux'.

Source Error: 


Line 52:             if (ModelState.IsValid)
Line 53:             {
Line 54:                 db.RefundRequests.Add(refundRequest);
Line 55:                 db.SaveChanges();
Line 56:                 return RedirectToAction("Index");

我在模型类的上下文中找不到任何东西,但我想我会添加它们以防万一。

[TypeLoadException: Could not load type 'eFormsRedux.DAL.FDCConext' from assembly 'eFormsRedux'.]
 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) +70
System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +40
System.Type.GetType(String typeName, Boolean throwOnError) +34
System.Data.Entity.Internal.InitializerConfig.TryGetInitializer(Type requiredContextType, String contextTypeName, String initializerTypeName, Boolean isDisabled, Func`1 initializerArgs, Func`3 exceptionMessage) +39

[InvalidOperationException: Failed to set database initializer of type 'eFormsRedux.DAL.FDCInitializer, eFormsRedux' for DbContext type 'eFormsRedux.DAL.FDCConext, eFormsRedux' 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) +236
System.Data.Entity.Internal.<>c__DisplayClass6.<TryGetInitializerFromEntityFrameworkSection>b__1(ContextElement e) +203
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +164
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) +94
<?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>
<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>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DatePicker;Data Source=(local)" 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>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<modules>
  <remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
<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.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.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="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
  </dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<contexts>
  <context type="eFormsRedux.DAL.FDCConext, eFormsRedux">
    <databaseInitializer type="eFormsRedux.DAL.FDCInitializer, eFormsRedux" />
  </context>
</contexts>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="v12.0" />
  </parameters>
</defaultConnectionFactory>
<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>

非常感谢任何帮助。

0 个答案:

没有答案