c#-无法从程序集“ System.Web,…”中加载类型“ …”
作者:互联网
<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显示以下错误:
Could not load type
‘Test.Library.UserAccountProvider.TestUserProfile’ from assembly
‘System.Web, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a’.
在语句返回时(TestUserProfile)Create(用户名);
解决方法:
也许您应该在该行的’type’属性的末尾添加完整的程序集名称(“,Test.Library.UserAccountProvider”),名称为“ =” TestProfileProvider“,如果这是您的类的位置?
像这样 :
<add name="TestProfileProvider" type="Test.Library.UserAccountProvider.TestProfileProvider, Test.Library.UserAccountProvider" connectionStringName="SecurityContext" applicationName="Sigma" applicationContext="XpressPago" />
与“ inherits”属性相同:
<profile defaultProvider="TestProfileProvider" inherits="Test.Library.UserAccountProvider.TestUserProfile, Test.Library.UserAccountProvider">
我认为Create不会在哪里选择该类,因为它会在“ System.Web”中尝试.
我当然认为Test.Library.UserAccountProvider是正确的程序集名称,如果需要的话请对其进行修复…
标签:membership-provider,net-assembly,app-config,c,asp-net-mvc 来源: https://codeday.me/bug/20191119/2037657.html