Reputation: 550
I have written custom roleProvider for my Silverlight application. Unfortunately I'm getting an error while loading:
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: Exception has been thrown by the target of an invocation.
Source Error:
Line 46: <providers>
Line 47: <clear />
Line 48: <add name="LanosRoleProvider" type="LANOS.Web.Security.LanosRoleProvider" applicationName="/" />
Line 49: </providers>
Line 50: </roleManager>
Source File: C:\path\LANOS\LANOS.Web\web.config Line: 48
This is definition of my role provider (class is inside Lanos.Web project):
namespace LANOS.Web.Security
{
public class LanosRoleProvider : RoleProvider
I have really no clue why this does not work. Before adding it to my application I've tested it on some sample projects and it worked fine. Any ideas?
Or at least could you tell me how to show that exception info which is being thrown at the time of config load?
Upvotes: 1
Views: 5449
Reputation: 57469
Just ran into this problem and my problem was that I was using property injection for a service used by the Custom Roles Provider. This service also required its dependencies to be injected by constructor. I missed a binding of one of these constructor dependencies which caused this ambiguous error to be thrown. I tried explaining this on here.
I hope it helps people coming from google like I did.
Upvotes: 1
Reputation: 3784
This happened to me because an exception was thrown in the constructor of my RoleProvider. Check your constructors call chain and and private member default assignments.
My particular issue was caused by a problem with EntityFramework in the constructor.
Clear out any constructor code in the provider and test to see if the error goes away and you'll know you are on the right track.
Upvotes: 0
Reputation: 5075
What version of ASP.NET are you running?
I would suggest adding the assembly to the element like so if your assembly is LANOS.Web.Security:
<add name="LanosRoleProvider" type="LANOS.Web.Security.LanosRoleProvider, LANOS.Web.Security" applicationName="/" connectionStringName="abcConnectionString" />
UPDATED
connectionStringName is a required attribute which is why the message is a parse error. This also means you will have to define a connection string in the section.
<connectionStrings>
<add name="abcConnectionString" connectionString="blah" />
</connectionStrings>
Hope this helps.
Upvotes: 2