我有一個自定義的MembershipProvider和一個自定義RoleProvider。我通過創建實現MembershipProvider類的SimpleMembershipProvider類創建了自定義MembershipProvider。之後,我改變了我的web.config並工作。自定義RoleProvider與MVC 2.0 webconfig
所以我用同樣的方法創建自定義RoleProvider。沒什麼特別的,只是創建一個實現RoleProvider類的SimpleRoleProvider類。但後來當我改變web.config文件並運行該解決方案我收到以下錯誤信息:
的Web.Config
<membership defaultProvider="DashboardMembershipProvider">
<providers>
<clear/>
<add name="SimpleMembershipProvider"
type="Dashboard.Web.Controlling.Account.SimpleMembershipProvider" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="DashboardRoleProvider">
<providers>
<clear/>
<add name="DashboardRoleProvider"
type="Dashboard.Web.Controlling.Account.DashboardRoleProvider" />
</providers>
</roleManager>
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: No parameterless constructor defined for this object.
Source Error
Line 78: <add name="SimpleRoleProvider"
Line 79: type="Dashboard.Web.Controlling.Account.SimpleRoleProvider" />
於是我在網上搜索。並試圖對類型屬性,它會生成以下錯誤:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'Dashboard.Web.Controlling.Account' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 78: <add name="SimpleRoleProvider"
Line 79: type="Dashboard.Web.Controlling.Account.SimpleRoleProvider,Dashboard.Web.Controlling.Account" />
我如何將能夠得到這個CustomRoleProvider工作有什麼建議? 任何幫助,非常感謝!