MVC4: UserIsInRole - Unable to connect to SQL Server database

后端 未结 3 1411
执念已碎
执念已碎 2020-12-13 21:40

Breaking my head around with this, yesterday it worked fine and today it seems to be broken:

This line is generating the error:

@if (Roles.IsUserInRo         


        
3条回答
  •  有刺的猬
    2020-12-13 22:14

    Adding this:

    [InitializeSimpleMembership]
    

    To the top of the HomeController fixes the issue.

    Explanation on the attribute:

    http://blogs.msdn.com/b/rickandy/archive/2012/08/15/initializesimplemembership-attribute-and-simplemembership-exceptions.aspx

提交回复
热议问题