Friday, June 17, 2016

External component has thrown an exception after framework upgrade on server

Leave a Comment

I recently upgraded a 2008 R2 Web server to .Net Framework 4.6.1. I then installed my ASP.NET MVC application on such which is built to .Net Framework 4.6.1. When I attempt to run the site, I get the following error.

External component has thrown an exception.  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.Runtime.InteropServices.SEHException: External component has thrown an exception.  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:    [SEHException (0x80004005): External component has thrown an exception.]    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.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +485    System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +190    System.Reflection.Assembly.LoadFrom(String assemblyFile) +54    WebActivator.ActivationManager.get_Assemblies() +244    WebActivator.ActivationManager.RunActivationMethods() +86    WebActivator.ActivationManager.RunPreStartMethods() +46    WebActivator.ActivationManager.Run() +68  [InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: External component has thrown an exception..]    System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +900    System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +164    System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +169    System.Web.Compilation.BuildManager.ExecutePreAppStart() +172    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +907  [HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: External component has thrown an exception..]    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +726 

I did same process on other similar servers and didn't hit an issue.

I did find that in IIS (which the site is running in), if I change the application pools "Load User Profile" setting to false then the site runs without a problem.

I don't just want to change this setting (unsure of its impact on the application), I would like to understand why I need to make such a change on this server and didn't need to on others. Was it the way the framework was installed or server is setup? Any feedback would be great.

(note: the server has version 4.5 installed and the site when built in such, ran without an issue)

2 Answers

Answers 1

I ran in this problem once, on many cases problem is due to some software in the dev suite that was not up to date. In my case the problem was caused due to Telerik justMock, The problem was resolved by updating justmock to latest version. Try to update or uninstall Telerik tools if you have one, Hope this solves your problem

Answers 2

External component has thrown an exception.

I had before similar problem after installing .Net Framework 4.6.1 - I have not figured out what component cause problem, but problem was related to missing .NET Framework 4.5.1 Targeting Pack.

Solution in my case:

(the order is important)

All downloaded form official site: Targeting .NET Platforms

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment