On a ASP.NET Web Application project we got a strange issue, when enumerating through the Claims collection of the ClaimsPrincipal we got a SQLException !?
Strange thing is that there was no place in our code where we were using SQL Server. So where was this error message coming from?
Turned out that the ClaimsPrincipal in ASP.NET is linked to a RoleManager by default that uses SQL Server as the backing store behind the scenes. Once we tried to access the claims, the RoleManager was called who tried to access SQL Server.
To solve it, we removed the default RoleManager module from the ASP.NET configuration using following code:
<modules>
<remove name="RoleManager" />