无法从程序集'System.Web,...'加载类型'...'

时间:2015-10-05 11:41:48

标签: c# asp.net-mvc app-config .net-assembly membership-provider

<system.web>
    <profile defaultProvider="TestProfileProvider" inherits="Test.Library.UserAccountProvider.TestUserProfile">
      <providers>
        <add name="TestProfileProvider" type="Test.Library.UserAccountProvider.TestProfileProvider, , Test.Library.UserAccountProvider" connectionStringName="SecurityContext" applicationName="Sigma" applicationContext="XpressPago" />
      </providers>
    </profile>
    <membership defaultProvider="TestMembershipProvider">
      <providers>
        <add name="TestMembershipProvider" type="Test.Library.UserAccountProvider.TestMembershipProvider, Test.Library.UserAccountProvider" connectionStringName="SecurityContext" passwordFormat="Clear" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="3" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="Sigma" PasswordResetLimit="45" applicationContext="XpressPago" />
      </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="TestRoleProvider">
      <providers>
        <add name="TestRoleProvider" type="Test.Library.UserAccountProvider.TestRoleProvider" connectionStringName="SecurityContext" applicationName="Sigma" applicationContext="XpressPago" />
      </providers>
    </roleManager>
    <httpRuntime executionTimeout="90" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>
    <machineKey validationKey="196975F087819B74AC983A6D0882E5936BD0F30915A770C58E1177505D72D46F2D6F50BDB35DDF4E904AE01FD3E62726A6E63ADED231644D2D2E595A84AA76B2" decryptionKey="4496E865CAED30BA35BE7B60A06023CC3A13422F15060346" validation="SHA1" />
  </system.web>

TestMembershipProvider未显示任何错误,但TestUserProfile显示以下错误:

  

无法加载类型   汇编中的'Test.Library.UserAccountProvider.TestUserProfile'   'System.Web,Version = 4.0.0.0,Culture = neutral,   公钥= b03f5f7f11d50a3a”。

声明return (TestUserProfile)Create(username);

1 个答案:

答案 0 :(得分:3)

也许你应该在&#39;类型&#39;的末尾添加完整的程序集名称(&#34;,Test.Library.UserAccountProvider&#34;)。具有名称=&#34; TestProfileProvider&#34;的行的属性如果它是你班级的位置?

像这样:

  <add name="TestProfileProvider" type="Test.Library.UserAccountProvider.TestProfileProvider, Test.Library.UserAccountProvider" connectionStringName="SecurityContext" applicationName="Sigma" applicationContext="XpressPago" />

同样的&#39;继承&#39;属性:

   <profile defaultProvider="TestProfileProvider" inherits="Test.Library.UserAccountProvider.TestUserProfile, Test.Library.UserAccountProvider">

我认为Create不会选择该类,因为它试图进入&#34; System.Web&#34;。
当然我认为Test.Library.UserAccountProvider是正确的程序集名称,如果需要就修复它......