Reputation: 20686
I have an MVC 4 app deployed to an Azure cloud service that has worked for months. Suddenly the app has stopped working, and I see 401 errors on a page that allows anonymous access. Digging into the event log reveals this:
<EventData>
<Data>System.AppDomain/50824127</Data>
<Data>System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Microsoft.IdentityModel.Claims.ClaimsPrincipal,Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. at System.Web.Hosting.ApplicationManager.GetUpdatedTotalCacheSize(Int64 sizeUpdate) at System.Web.Hosting.ObjectCacheHost.System.Runtime.Caching.Hosting.IMemoryCacheManager.UpdateCacheSize(Int64 size, MemoryCache memoryCache) at System.Runtime.Caching.CacheMemoryMonitor.GetCurrentPressure() at System.Runtime.Caching.MemoryMonitor.Update() at System.Runtime.Caching.MemoryCacheStatistics.CacheManagerThread(Int32 minPercent) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading._TimerCallback.PerformTimerCallback(Object state)</Data>
<Data>w3wp</Data>
<Data>2548</Data>
</EventData>
After hours and hours of troubleshooting and inspecting configurations, I am unable to figure out a reason why this would be happening. The assembly, Microsoft.IdentityModel, 3.5.0.0 is in the bin folder in the deployment package, and the project has the correct references to the WIF nuget packages.
What's worse is that my project works in one azure cloud service, but not in another (which fails as described above). There seem to be a limited number of related questions, such as Type is not resolved for member "Microsoft.IdentityModel.Claims.ClaimsPrincipal,Microsoft.IdentityModel", but this one has to do with running sitefinity on a developer workstation, and my problem is in the cloud.
Any ideas?
Upvotes: 0
Views: 3065
Reputation: 9764
We had an similar issue in our Azure project, but not exactly the same. Our error was
Unable to Find Assembly 'Microsoft.IdentityModel'
The reason is Azure virtual machines don't have WIF on them by default. Even if we have Microsoft.IdentityModel
in our bin folder, when application try to resolve the reference to Microsoft.IdentityModel
, and even though it's unrelated, it fails and throw the missing reference error.
This issue can fixed by Installing WIF in a startup task. This link contains detais to how to do that.
Upvotes: 1