I recently performed the following steps on my VirtoCommerce Site:
Updated my Local Environment from 2.9 to 2.10 via Git.
Publish to Azure the Manager App. (Overwriting 2.9 on Azure)
Publish to Azure the Storefront. (Overwriting 2.9 on Azure)
I got a Typeload error that LibSass_64 couldnt be loaded. Realised my Dev Machine is x64 but the Azure server is x86, so I changed the Build configs in both solutions to x86 and republished with the "remove existing files" setting to clear the x64 dlls.
That solved the typeload error. However now I am getting the following error I am unable to resolve without help. Any help will be greatly appreciated!
Error calling StoreModuleGetStores:
Could not load type 'CacheManager.Core.RuntimeCachingBuilderExtensions' from assembly 'CacheManager.SystemRuntimeCaching, Version=0.7.1.0, Culture=neutral, PublicKeyToken=null'
Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,Object[] parameters, Object[] arguments) +92
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101
Owin.Loader.<>c__DisplayClass12.<MakeDelegate>b__b(IAppBuilder builder) +66
Owin.Loader.<>c__DisplayClass1.<LoadImplementation>b__0(IAppBuilder builder) +123
Microsoft.Owin.Host.SystemWeb.<>c__DisplayClass2.<InitializeBlueprint>b__0(IAppBuilder builder) +71
Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +462
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +40
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +70
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +534
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +352
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
You should not change the build platform. Everything should be compiled for "Any CPU" platform.
The original issue with LibSass_64 has happened because the publishing process has copied LibSass.x64.dll and libsassnet.dll to the bin directory. These assemblies should be deleted from bin and there is a special action in the storefront project to do this. Unfortunately the publishing process either doesn't run this action or copies libsass assemblies to the bin anyway. Need to sort this out.
At the same time the bin directory should contain the LibSassNetProxy.dll, which will load the correct version of libsass assemblies from App_Data directory depending on the platform at runtime.
Related
I use IdentityServer4 for auth which gets installed with Asp.net core web project in visual studio 2019. After upgrading to asp.net 3.1, I get below error on SignOut. I tried force update all the Nugets to latest. Still, I couldn't make it work. Appreciate any workaround.
TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.IReadableStringCollectionExtensions' from assembly 'IdentityServer4, Version=3.1.0.0, Culture=neutral, PublicKeyToken=f294d0afe402bb2b'.
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.GetParametersAsync(HttpRequest request)
System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<TStateMachine>(ref TStateMachine stateMachine)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>.Start<TStateMachine>(ref TStateMachine stateMachine)
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.GetParametersAsync(HttpRequest request)
Microsoft.AspNetCore.ApiAuthorization.IdentityServer.AutoRedirectEndSessionEndpoint.ProcessAsync(HttpContext ctx)
IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
I fixed this by reverting the IdentityServer4.EntityFramework reference from version 3.1.0 to 3.0.2, it would seem that the missing type is not yet implemented in 3.1.0.
I spent a few days researching this for work and I was unable to find any official documentation with regards to the problem or to the missing type. So the solution came from exasperation more than anything else. I apologize that I cannot provide you with adequate reasoning as to why it needs to be reverted, just that by doing it I fixed it.
for me
I have DAL has
IdentityServer4.EntityFramework and IdentityServer4
also the layer of ClientSlide has IdentityServer4 package changes all them to 3.0.2 instead of 3.1.0 solves the issue
For me the problem was resolved by uninstalling the Nuget package IdentityServer4 version 3.1.1 and letting the framework use the builtin one with version 3.0.0.
I have been working on a VB.net web application for some time now, and I accidentally switched the "Application Type" setting from a Class Library to a Windows Form Application. I tried to build, this failed, but when I switched back, the program would no longer execute, displaying the error:
Unable to start program 'C:\Users\User\...\bin\Project.dll'
'C:\Users\User\...\bin\Project.dll' is not a valid Win32 application.
Prior to this the application would build fine.
Furthermore, in the properties page for the project, the "Web" section displays the error:
An error occurred trying to load the page.
Value does not fall within the expected range.
The build output offers no clues as to the unexpected behavior, it builds fine, it just won't run. The code is also fully functional.
I have tried restarting multiple times, deleting the /bin directory and allowing it to rebuild from scratch (then restoring the old contents when this failed), setting the startup project, changing the target CPU and debug/release mode. I have tried both ReSharper build, and Visual Studio build.
I also tried making a build configuration that targeted 'C:\Users\User...\bin\Project.vshost.exe', but this would execute then close immediately.
I have no option to set a "Startup Object" in the application page of the project settings, but this has never been an issue. I have never needed to target an EXE to run my application before. If I try other application types, it states "Sub Main was not found in project".
I cannot recreate the project due to it's size so would love it if anyone could offer some insight, next time I will be mindful not to play around with the IDE settings.
======= UPDATED =======
So I fixed the "not running issue" by changing the WebProjectProperties to:
<UseIIS>True</UseIIS>
<UseCustomServer>False</UseCustomServer>
<servers defaultServer="">
But now when I run the program, the following error is displayed:
Could not load file or assembly
'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of
its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
System.IO.FileLoadException: Could not load file or assembly
'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of
its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
Stack trace and details:
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.VisualStudio.QualityTools.UnitTestFramework (2) | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/User/Source/Repos/Findem/IfitConsulting/
LOG: Initial PrivatePath = C:\Users\User\Source\Repos\Findem\IfitConsulting\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\User\Source\Repos\Findem\IfitConsulting\web.config
LOG: Using host configuration file: C:\Users\User\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/0ef61219/b7128029/Microsoft.VisualStudio.QualityTools.UnitTestFramework (2).DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/0ef61219/b7128029/Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)/Microsoft.VisualStudio.QualityTools.UnitTestFramework (2).DLL.
LOG: Attempting download of new URL file:///C:/Users/User/Source/Repos/Findem/IfitConsulting/bin/Microsoft.VisualStudio.QualityTools.UnitTestFramework (2).DLL.
WRN: Comparing the assembly name resulted in the mismatch: NAME
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack trace
[FileLoadException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531
[HttpException (0x80004005): Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework (2)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947380
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
Ok so finally figured out how to fix it, hopefully this can help some other poor soul who ends up in the same situation!
The first step is to edit your project.vbproj file and change:
<WebProjectProperties>
<UseIIS>False</UseIIS>
<UseCustomServer>True</UseCustomServer>
<servers defaultServer="SelfHostServer">
...
</servers>
</WebProjectProperties>
To
<WebProjectProperties>
<UseIIS>True</UseIIS>
<UseCustomServer>False</UseCustomServer>
<servers defaultServer="">
...
</servers>
</WebProjectProperties>
Then, you want to go to your /bin directory and delete the following files (Project is your projects name):
Project.dll
Project.dll.CodeAnalysisLog.xml
Project.dll.config
Project.dll.CodeAnalysisLog
Project.pdb
Project.xml
And re-build and it all works fine!
My MVC4 Web Api application is working fine when it is build in Any Cpu mode.In this mode it is creating 32 bit dll. However when I build the application in x64 mode then while executing it is giving following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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.BadImageFormatException: Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'CoreService' could not be loaded.
=== Pre-bind state information ===
LOG: User = xxx
LOG: DisplayName = CoreService
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: CoreService | Domain ID: 3
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///D:/StartFromScratch/src/CoreService/
LOG: Initial PrivatePath = D:\StartFromScratch\src\CoreService\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\StartFromScratch\src\CoreService\web.config
LOG: Using host configuration file: C:\Users\310138409\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/a4e7fe2c/87c2ced5/CoreService.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/a4e7fe2c/87c2ced5/CoreService/CoreService.DLL.
LOG: Attempting download of new URL file:///D:/StartFromScratch/src/CoreService/bin/CoreService.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +258
System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): Could not load file or assembly 'CoreService' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055
I am not getting any concrete solution for the same. Moreover we cannot continue in 32 bit mode as It is making call to 64 bit unmanaged code. Thanks in advance.
Actually problem is because of IISExpress. It is 32bit of IISExpress is running whenever we are executing from VS2012 IDE so it is giving incorrect format error. So once I installed the IISexpress 8.0 and done the registry entry to make sure that IISExpress 64 bit get executed from VS2012; my problem got resolved.
You should properly configure your solution configurations for x64 build. Right click on your solution in VS, select Configuration Manager select x64 under Active solution platforms drop down list and check whether all of your projects has built with x64 platform.
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
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.
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.
I just had the same problem. One way to solve it is to add a reference to the DLL specified in the other posts.
Another option is to replace the section with this one, that uses a class available in the core .Net Framework 4.5 (you must add a reference to System.IdentityModel too):
<issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<trustedIssuers>
<add thumbprint="[print]" name="[issuer]" />
</trustedIssuers>
</issuerNameRegistry>
MSFT claims that .NET 4.5 is backwards compatible with .NET 4. I went ahead and installed .NET 4.5 and VS 11, then created a new ASP.NET MVC 4 Web API project. When I reference the Castle.ActiveRecord.dll (version 3.0.0.0) into my Web API project, every controller action then generates this error:
[FileNotFoundException: Could not load file or assembly 'Lucene.Net, Version=2.3.1.3, Culture=neutral, PublicKeyToken=45b1dda587cdc860' or one of its dependencies. The system cannot find the file specified.]
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) +0
System.Reflection.RuntimeAssembly.GetExportedTypes() +49
System.Web.Http.Dispatcher.HttpControllerTypeCacheUtil.FilterTypesInAssemblies(IBuildManager buildManager, Predicate`1 predicate) +210
System.Web.Http.Dispatcher.HttpControllerTypeCache.InitializeCache() +119
System.Web.Http.Dispatcher.HttpControllerTypeCache..ctor(HttpConfiguration configuration) +69
System.Web.Http.Services.DefaultServiceResolver.<.ctor>b__0(HttpConfiguration config) +241
System.Web.Http.Services.DefaultServiceResolver.GetService(Type t) +80
System.Web.Http.DependencyResolverExtensions.GetService(DependencyResolver resolver) +201
System.Web.Http.DependencyResolverExtensions.GetServiceOrThrow(DependencyResolver resolver) +60
System.Web.Http.Dispatcher.HttpControllerDispatcher..ctor(HttpConfiguration configuration) +65
System.Web.Http.GlobalConfiguration.<.cctor>b__1() +64
System.Lazy`1.CreateValue() +13589652
System.Lazy`1.LazyInitValue() +476
System.Web.Http.WebHost.HttpControllerHandler.<.cctor>b__b() +53
System.Lazy`1.CreateValue() +455
System.Lazy`1.get_Value() +13590694
System.Web.Http.WebHost.HttpControllerHandler.BeginProcessRequest(HttpContextBase httpContextBase, AsyncCallback callback, Object state) +224
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +444
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +354
This is interesting because from what I read. the version 2.3.1.3 is a Lucene (java) version, not a Lucene.Net version. I checked NuGet just to be sure, and it has no version 2.3.1.3 available for Lucene.Net.
What gives? I'd love to get running with the new ASP.NET MVC 4 Web API project, as it blends what I love about ASP.NET MVC and WCF Web API. Any ideas as to how to get around this issue?
I posted the solution on asp.net forums where the question originated.
http://forums.asp.net/post/4861300.aspx