无法从程序集“系统.Web, ..”加载类型“..”

本文关键字:加载 类型 Web 系统 程序集 | 更新日期: 2023-09-27 18:16:07

<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, 版本=4.0.0.0, 区域性=中性, PublicKeyToken=b03f5f7f11d50a3a'.

关于声明return (TestUserProfile)Create(username);

无法从程序集“系统.Web, ..”加载类型“..”

也许你应该在 name="TestProfileProvider" 的行的 'type' 属性末尾添加完整的程序集名称 (", Test.Library.UserAccountProvider"( 如果它是你的类的位置?

喜欢这个:

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

"继承"属性也是如此:

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

我认为 Create 没有在哪里选择类,因为它在"System.Web"中尝试。
当然,我想Test.Library.UserAccountProvider是正确的程序集名称,如果需要,请修复它...