Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Azure intermittent Identity error when parsing webconfig

This issue happens seemingly randomly after publishing. The site will work fine and then bam, I get this error parsing the webconfig. I just republish and it works fine for a bit again. When publishing, I checked the box to remove existing files so there shouldn't be garbage laying around.

This is an MVC4 project using .net 4.5 and Azure Access Control Service (ACS) integrated with Yahoo!. This error occurs when redirecting back from Yahoo. This way happening every time, but I found a post (which I can not find now, of course) where there was a bug with the 4.5.1 Identity and Access Visual Studio integration. I went to the previous version and now it's only sometimes.

ID8030: The value of the 'type' property could not be parsed.
Verify that the type attribute of '<issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry"><authority name="[my authority]"><keys><add thumbprint="[print]" /></keys><validIssuers><add name="[issuer]" /></validIssuers></authority></issuerNameRegistry>' element is correct.

In the above error message, I have replaced the items in brackets ([]) for this post.

Here is the stack trace:

[TypeLoadException: ID8030: The value of the 'type' property could not be parsed. *** element is correct.]
System.IdentityModel.Configuration.TypeResolveHelper.Resolve(ConfigurationElementInterceptor customTypeElement, Type customType) +602659
System.IdentityModel.Configuration.IdentityConfiguration.GetIssuerNameRegistry(IssuerNameRegistryElement element) +114
System.IdentityModel.Configuration.IdentityConfiguration.LoadHandlerConfiguration(IdentityConfigurationElement element) +841
System.IdentityModel.Configuration.IdentityConfiguration.LoadConfiguration(IdentityConfigurationElement element) +117
System.IdentityModel.Configuration.IdentityConfiguration..ctor(String identityConfigurationName) +180
System.IdentityModel.Services.Configuration.FederationConfiguration.LoadConfiguration(FederationConfigurationElement element) +392
System.IdentityModel.Services.Configuration.FederationConfiguration..ctor(Boolean loadConfig) +94
System.IdentityModel.Services.FederatedAuthentication.CreateFederationConfiguration() +71
System.IdentityModel.Services.FederatedAuthentication.get_FederationConfiguration() +85
System.IdentityModel.Services.HttpModuleBase.Init(HttpApplication context) +56
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): ***... element is correct.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873784
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
like image 593
MPavlak Avatar asked Aug 18 '13 16:08

MPavlak


2 Answers

I had the same issue when running local. I was going through the How-To found here: http://msdn.microsoft.com/en-us/library/jj161104.aspx and would get the type not found error on that assembly.

I double checked to make sure I pulled down the assembly via NuGet and even uninstalled and reinstalled it... no dice. It basically boiled down to a missing reference to the System.IdentityModel.Tokens.ValidatingIssuerNameRegistry

So, if you did pull this down via NuGet and you still have the issue, remember that when NuGet drops this package, it will throw it in a packages folder that's at the solution level in the file system.

If your project doesn’t show a reference to System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, add the assembly to your project by right clicking the project, select Add Reference, Browse, then click the Browse button and then browse up to the packages folder and find the dll ([Your Solution Root]packages\System.IdentityModel.Tokens.ValidatingIssuerNameRegistry.4.5.1\lib\net45) and add it.

I hope this helps.

like image 170
Dwayne Avatar answered Nov 15 '22 08:11

Dwayne


I ran into the same issue but it was constant for me, not sporadic, so perhaps a different underlying root issue.

I was able to fix the issue though by installing the following NuGet package in my MVC 4 project: http://www.nuget.org/packages/System.IdentityModel.Tokens.ValidatingIssuerNameRegistry/

I can't remember if this was added by default in a new MVC 4 project. I did at one point remove it so perhaps it may have been removing then reinstalling that resolved the issue. Either way, by adding the package above back I was able to get my MVC 4 project working with ACS correctly.

Hope it works for you as well.

like image 39
Kevin Rivers Avatar answered Nov 15 '22 08:11

Kevin Rivers