Could not load type 'Thinktecture.IdentityModel.IdentityModelConfiguration'

Jun 28, 2012 at 2:55 PM

I tried adding the NuGet Thinktecture.IdentityModel and ThinkTecture.IdentityModel.Web to my Web Site that hosts my REST service. and then tried to follow the sample code in the source code downloaded from github for ThinkTecture.IdentityModel.Web to get a token and call the service.

The first problem I ran into was the Nuget ThinkTecture.IdentityModel.Web package's WebSecurityTokenHandlerCollectionManager did not have a definition for the AddDefaultHandler() method used in the samples code downloaded from GitHub; So, I could not compile the Globals.asax.cs file.

Ok, maybe I can reference the ThinkTecture.IdentityModel.Web.dll in the GitHub in the bin foder that I built from the source code. It has the method defined there. That got rid of my compiler problems.

However, when loading the Web Site to do debugging I now run into a runtime loading issue:

Server Error in '/RestPortal' Application.
--------------------------------------------------------------------------------

Could not load type 'Thinktecture.IdentityModel.IdentityModelConfiguration' from assembly 'Thinktecture.IdentityModel, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null'. 
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.TypeLoadException: Could not load type 'Thinktecture.IdentityModel.IdentityModelConfiguration' from assembly 'Thinktecture.IdentityModel, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null'.

Source Error: 


Line 82: 
Line 83:             return manager;
Line 84:         }
Line 85:     }
Line 86: }
 

Source File: C:\Builds\trunk\sageCrowd\RestPortal\Global.asax.cs    Line: 84 

Stack Trace: 


[TypeLoadException: Could not load type 'Thinktecture.IdentityModel.IdentityModelConfiguration' from assembly 'Thinktecture.IdentityModel, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null'.]
   sageCrowd.Portal.Global.SetupSecurityTokenHandler() in C:\Builds\trunk\sageCrowd\RestPortal\Global.asax.cs:84
   sageCrowd.Portal.Global.RegisterRoutes(RouteCollection routes) in C:\Builds\trunk\sageCrowd\RestPortal\Global.asax.cs:30
   sageCrowd.Portal.Global.Application_Start(Object sender, EventArgs e) in C:\Builds\trunk\sageCrowd\RestPortal\Global.asax.cs:17

[HttpException (0x80004005): Could not load type 'Thinktecture.IdentityModel.IdentityModelConfiguration' from assembly 'Thinktecture.IdentityModel, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null'.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4057141
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Could not load type 'Thinktecture.IdentityModel.IdentityModelConfiguration' from assembly 'Thinktecture.IdentityModel, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11700896
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4869125

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 

 

Where in god's name is that coming from why does the source for ThinkTecture.IdentityModel.Web depend on a clearly invalid version of Thinktecutre.IdentityModel?

Where do I go from here???