title: Could not load EnterpriseLibrary assemblies when rendering view in MVC application
body: <p>When rendering a view in an ASP.NET MVC application, I am getting the following Yellow Screen of Death. It will occur only once during the server lifecycle, subsequent renders work fine. I don't have any references to EnterpriseLibrary 4.0.0.0 within the application itself, which makes me think that the reference is outside of my application (machine.config or something similar). I have checked for EnterpriseLibrary references in C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config and C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config but neither had any reference. Any ideas?</p>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT: The error is occurring on the following line:
  &lt; asp:ScriptManager ID="ScriptManager2" EnablePartialRendering="false" runat="server" / >
  ., it previously appeared the error was occurring on the call to Telerik.</p>
  
  <p>EDIT2: I can fix the error by removing &lt; asp:ScriptManager ID="ScriptManager2" EnablePartialRendering="false" runat="server" /> which further points towards this being the problem. I am unsure as to why it is happening, however, and cannot claim I have an answer to the problem.</p>
  
  <p>Here is the YSOD:</p>
  
  <pre><code>Server Error in '/services' Application.
  --------------------------------------------------------------------------------
  
  Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 
  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.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
  
  Source Error: 
  
  
  Line 153:&lt;asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server"&gt;
  Line 154:   
  Line 155:   &lt; asp:ScriptManager ID="ScriptManager2" EnablePartialRendering="false" runat="server" / &gt;
  Line 156:   &lt;%= Html.Telerik().ScriptRegistrar() %&gt;
  Line 157:   
  
  
  Source File: c:\HIP\HWMI.API\HWMI.API.Web\Views\Membership\UserSubscriptionDetails.aspx    Line: 155 
  
  Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.
  
  
  === Pre-bind state information ===
  LOG: User = HWI\jyoung
  LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
   (Fully-specified)
  LOG: Appbase = file:///C:/HIP/HWMI.API/HWMI.API.Web/
  LOG: Initial PrivatePath = C:\HIP\HWMI.API\HWMI.API.Web\bin
  Calling assembly : Microsoft.Practices.EnterpriseLibrary.Security.Cache.Configuration.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
  ===
  LOG: This bind starts in default load context.
  LOG: Using application configuration file: C:\HIP\HWMI.API\HWMI.API.Web\web.config
  LOG: Using host configuration file: 
  LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
  LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
  LOG: The same bind was seen before, and was failed with hr = 0x80070002.
  
  
  
  Stack Trace: 
  
  
  [FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
     System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
     System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +180
     System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +192
     System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly&amp; lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType&amp; attributeType, IRuntimeMethodInfo&amp; ctor, Boolean&amp; ctorHasParameters, Boolean&amp; isVarArg) +115
     System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +426
     System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
     System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
     System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76
     System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +388
     System.Web.UI.ScriptManager..ctor() +26
     ASP.views_membership_usersubscriptiondetails_aspx.__BuildControlScriptManager2() in c:\HIP\HWMI.API\HWMI.API.Web\Views\Membership\UserSubscriptionDetails.aspx:155
     ASP.views_membership_usersubscriptiondetails_aspx.__BuildControlContent3(Control __ctrl) in c:\HIP\HWMI.API\HWMI.API.Web\Views\Membership\UserSubscriptionDetails.aspx:153
     System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
     System.Web.UI.MasterPage.InstantiateInContentPlaceHolder(Control contentPlaceHolder, ITemplate template) +87
     ASP.views_shared_site_master.__BuildControlScriptContent() in c:\HIP\HWMI.API\HWMI.API.Web\Views\Shared\Site.Master:389
     ASP.views_shared_site_master.__BuildControlTree(views_shared_site_master __ctrl) in c:\HIP\HWMI.API\HWMI.API.Web\Views\Shared\Site.Master:1
     ASP.views_shared_site_master.FrameworkInitialize() in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\services\1a8554fb\b8d3a14c\App_Web_b1lugo2u.0.cs:0
     System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
     System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8832342
     System.Web.UI.Page.get_Master() +54
     System.Web.UI.Page.ApplyMasterPage() +15
     System.Web.UI.Page.PerformPreInit() +45
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328
  
  
  
  
  --------------------------------------------------------------------------------
  Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 
  </code></pre>