简体   繁体   中英

Configuration Error - Exception has been thrown by the target of an invocation

I have built a custom membership provider that I have used in a previous asp.net mvc app with no problems.

Now I am trying to use it in an asp.net webforms app and I keep getting Configuration Error - Exception has been thrown by the target of an invocation.

There is no stack trace on error page and the breakpoint in my membership provider's constructor wont get hit.

I have read that I need to check the inner exception to find out the true problem, but I'm having trouble getting to that point.

This can occur any time an exception is thrown inside of a delegate which was dynamically Invoked.

The delegate invoke call is catching the exception, and wrapping it in a new Exception.

When you catch this, there will be a InnerException property. This will contain the original exception which was raised from within the delegate. If you debug the exception, you should be able to see this. The exception window will display this information. Alternatively, if you put a break point in your exception handler, you can see the exception information, including the inner exception, in the locals window.

Once you find the InnerException, you will have access to the original error as well as the original stack trace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM