Update on Thinktecture.IdentityServer for .NET 4.5

I made some progress on the 4.5 version. It is now a real .NET 4.5/MVC 4 application and I made some minor changes to data handling:

  • Switched to the new universal providers for ASP.NET
  • Switched to SQL Server LocalDB as the default option for the provider database. The database will be created automatically if it doesn’t exist. Of course you can change the database by modifying connectionStrings.config.
  • Added a database creation initializer for the configuration database. This will create a fresh config database with sensible default values.


This entry was posted in IdentityModel, IdentityServer, WebAPI. Bookmark the permalink.

15 Responses to Update on Thinktecture.IdentityServer for .NET 4.5

  1. I just forked a copy of this and it is complaining about the dlls in the WebSite/_bin_deployableAssemblies directory. How can I resolve this?

  2. Nuget Package Restore did not fix it, but when I removed the nuget package and reinstalled Microsoft.SqlServer.Compact then did Install-Package EntityFramework -IncludePreRelease that seemed to work

  3. Do you have a sample web service implementation that receives a token and extracts the claims data from it? I’m using the OAuth2 endpoint and can get the token and send it to a service, but I’m not sure how to use the token with the service to get claims.

  4. I cloned that repo and published it locally. Now when I run it, I get this exception:

    Attempted to access an element as a type incompatible with the array.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.]
    System.Collections.Generic.List`1.Insert(Int32 index, T item) +62
    Resources.Configuration.AuthenticationConfig.ConfigureGlobal(HttpConfiguration globalConfig) in c:\…\Thinktecture.IdentityModel.45\Samples\Web API\Resources\Configuration\AuthenticationConfig.cs:15
    WebApiSecurity.WebApiApplication.Application_Start() in c:\…\Thinktecture.IdentityModel.45\Samples\Web API\WebHost\Global.asax.cs:15

    [HttpException (0x80004005): Attempted to access an element as a type incompatible with the array.]
    System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12834649
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

    [HttpException (0x80004005): Attempted to access an element as a type incompatible with the array.]
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12847312
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12675965

    • I made some modifications to the Rsources.Constants to match my deployment info and also commented out the connectionstring in Web.config and changed the DefaultAuthenticationScheme = “JsonWebToken” but the error above remains.

    • I am trying to debug. I reset my IdentityModel repo back to what you have on github. Here is the current error: “The value of the property ‘type’ cannot be parsed. The error is: The type ‘Thinktecture.IdentityServer.TokenService.RepositoryUserNameSecurityTokenHandler, Thinktecture.IdentityServer.Core’ cannot be resolved. Please verify the spelling is correct or that the full type name is provided.”

      Although I access it from https://adfs.example.com/webapisecurity — the error complains from the Identity Server (https://adfs.example.com). The error is referring to line 11 of identity.config

  5. Hi, I am unable to use “database creation initializer” for creating configuration database .as in earlier version this configuration database is exist in Add_Data folder.So how can i use the intilaizer to create the configuration database ?

  6. I am using Oauth2 endpint to get the token and than send this token to service for getting Claims.Before sending this oauth2 token to service , saving it and checking its expiration.So here i have two doubts, (1) can i save this token in cokkies or browser header (2) can i get the claims(in Token) while getting token. ??

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s