3

我正在尝试构建 asp.net mvc4 应用程序,并且在运行该应用程序时,我在Exception has been thrown by the target of invocationlazyinitializer 的语句中收到错误消息。请帮忙。提前致谢。我的代码如下

namespace CMMIS.Web.Filters
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute
{
    private static SimpleMembershipInitializer _initializer;
    private static object _initializerLock = new object();
    private static bool _isInitialized;

    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        // Ensure ASP.NET Simple Membership is initialized only once per app start
        LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
    }
4

1 回答 1

0

这是因为在 webconfig 中模仿了 LazyInitializer。只需将其删除,代码将运行良好

于 2015-06-03T20:23:49.173 回答