title: External Component Thew An Exception
body: <p>I am having a very weird error on one of my websites. This error only happens on this particular website even though it uses a CMS that is being used by many others. This error also doesn't happen on my test machine, it only happens on the live server.</p>
  
  <p>The error is as follows:</p>
  
  <pre><code>System.Web.HttpCompileException: External component has thrown an exception.
  </code></pre>
  
  <p>The stack trace is pretty generic:</p>
  
  <pre><code>System.Web.HttpParseException (0x80004005): External component has thrown an exception. ---&gt; System.Web.HttpCompileException (0x80004005): External component has thrown an exception.
     at System.Web.Compilation.AssemblyBuilder.Compile()
     at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
     at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
     at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
     at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
     at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)
     at System.Web.UI.PageParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData)
     at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)
     at System.Web.UI.TemplateParser.ProcessException(Exception ex)
     at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
     at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
     at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
     at System.Web.UI.TemplateParser.ParseInternal()
     at System.Web.UI.TemplateParser.Parse()
     at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
     at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
     at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
     at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
     at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
     at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
     at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
     at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
     at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
     at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
     at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)
     at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)
  </code></pre>
  
  <p>One of the exceptions revealed a little bit more detail:</p>
  
  <p>System.ComponentModel.Win32Exception: Access is denied</p>
  
  <pre><code>System.Web.HttpParseException (0x80004005): Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\196f56ec\d58fdc6d\2hgkxonl.cmdline". ---&gt; System.Web.HttpParseException (0x80004005): Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\196f56ec\d58fdc6d\2hgkxonl.cmdline". ---&gt; System.Runtime.InteropServices.ExternalException (0x80004005): Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\196f56ec\d58fdc6d\2hgkxonl.cmdline". ---&gt; System.ComponentModel.Win32Exception (0x80004005): Access is denied
     at System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String&amp; outputName, String&amp; errorName, String trueCmdLine)
     at System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String&amp; outputName, String&amp; errorName, String trueCmdLine)
     at Microsoft.CSharp.CSharpCodeGenerator.Compile(CompilerParameters options, String compilerDirectory, String compilerExe, String arguments, String&amp; outputFile, Int32&amp; nativeReturnValue, String trueArgs)
     at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
     at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames)
     at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerParameters options, String[] fileNames)
     at System.Web.Compilation.AssemblyBuilder.Compile()
     at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
     at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
     at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
     at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
     at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)
     at System.Web.UI.PageParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData)
     at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)
     at System.Web.UI.TemplateParser.ProcessException(Exception ex)
     at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
     at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
     at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
     at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
     at System.Web.UI.TemplateParser.ParseInternal()
     at System.Web.UI.TemplateParser.Parse()
     at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
     at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
     at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
     at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
     at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
     at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
     at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
     at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
     at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
     at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
     at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)
     at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)
  </code></pre>
  
  <p>The YSOD also showed this:</p>
  
  <pre><code>Parser Error Message: Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\196f56ec\d58fdc6d\2hgkxonl.cmdline".
  </code></pre>
  
  <p>Does this mean that an Asp.Net exe file is denying requests from my website? This error is random too; sometimes it works and sometimes I get this. Any ideas?</p>