ASP.Net Universal Membership RoleProvider未为角色缓存创建cookie

ASP.Net Universal Membership RoleProvider未为角色缓存创建cookie,asp.net,asp.net-mvc-3,asp.net-membership,membership-provider,Asp.net,Asp.net Mvc 3,Asp.net Membership,Membership Provider,ASP.net universal membership中的默认角色提供程序未创建缓存该角色的Cookie。有什么想法吗 <roleManager enabled="true" createPersistentCookie="true" cacheRolesInCookie="true" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtec

ASP.net universal membership中的默认角色提供程序未创建缓存该角色的Cookie。有什么想法吗

<roleManager enabled="true" createPersistentCookie="true" cacheRolesInCookie="true" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" defaultProvider="DefaultRoleProvider" >
  <providers>
    <clear />
    <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
</roleManager>

我正在使用MVC和AuthorizeAttributes,每次检查角色级别时,数据库都会被命中。cookie.asproles似乎没有被创建

微型档案显示

ExecuteStoreCommands Execute GetResults System.Collections.Generic.IEnumerable<T>.GetEnumerator GetRolesNamesForUser GetRolesForUser
DECLARE @appName nvarchar = N'/',
        @userName nvarchar = N'TestUser'

SELECT 
[Project1].[RoleName] AS [RoleName]
FROM ( SELECT 
        [Extent2].[RoleName] AS [RoleName]
        FROM    [dbo].[Users] AS [Extent1]
        CROSS JOIN [dbo].[Roles] AS [Extent2]
        INNER JOIN [dbo].[Applications] AS [Extent3] ON [Extent3].[ApplicationId] = [Extent2].[ApplicationId]
        INNER JOIN [dbo].[UsersInRoles] AS [Extent4] ON ([Extent1].[UserId] = [Extent4].[UserId]) AND ([Extent4].[RoleId] = [Extent2].[RoleId])
        WHERE ((LOWER([Extent3].[ApplicationName])) = @appName) AND ((LOWER([Extent1].[UserName])) = @userName)
)  AS [Project1]
ORDER BY [Project1].[RoleName] ASC   
executesToRecommends执行GetResults System.Collections.Generic.IEnumerable.GetEnumerator GetRolesNamesForUser GetRolesForUser
声明@appName nvarchar=N'/',
@用户名nvarchar=N'TestUser'
挑选
[Project1]。[RoleName]作为[RoleName]
从(选择
[extend2].[RoleName]作为[RoleName]
来自[dbo].[Users]作为[Extent1]
交叉连接[dbo].[Roles]作为[Extent2]
将[dbo].[Applications]作为[Extent3].[ApplicationId]=[Extent2].[ApplicationId]上的[Extent3]进行内部联接
在([Extent1].[UserId]=[Extent4].[UserId])和([Extent4].[RoleId]=[Extent2].[RoleId])上将[dbo].[UsersInRoles]作为[Extent4]进行内部联接
其中((较低([Extent3].[ApplicationName]))=@appName)和((较低([Extent1].[UserName]))=@UserName)
)AS[Project1]
由[Project1][RoleName]ASC订购

谢谢

它在实时服务器上工作,所以这很奇怪。我猜问题解决了。

真奇怪。对我来说,它可以在开发机器上工作,但不能在服务器上工作,cookie永远不会被创建。