Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly System.Web.WebPages.Deployment

Im working developing a system web page and suddenly appears this error:

Could not load file or assembly 'System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I already verify my xml files configuration, and everything look good. This is the stack trace:

[FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   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) +210
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122

[ConfigurationErrorsException: Could not load file or assembly 'System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12480704
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +202
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +331
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +148
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12601936
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12441597
like image 871
user2024262 Avatar asked Jun 04 '14 14:06

user2024262


1 Answers

I wrote a long post about this on my personal blog to document the problem for my future use, but I will just put the solution here for anyone else to use:

You need to install WebMatrix

Long story short the required DLLs are missing from the GAC MSIL and they need to be installed. You can install both versions of WebMatrix 1.0.0.0 and 2.0.0.0 as they can coexist just fine; or just install the one you need:

+--------------------------+---------------------------------------------------------------------+-------------+
|      Installer name      |                                 URL                                 | DLL Version |
+--------------------------+---------------------------------------------------------------------+-------------+
| AspNetWebPages.msi       | https://www.microsoft.com/en-us/download/confirmation.aspx?id=15979 |     1.0.0.0 |
| AspNetWebPages2Setup.exe | https://www.microsoft.com/en-us/download/details.aspx?id=34600      |     2.0.0.0 |
+--------------------------+---------------------------------------------------------------------+-------------+

Clickable links

  • https://www.microsoft.com/en-us/download/confirmation.aspx?id=15979
  • https://www.microsoft.com/en-us/download/details.aspx?id=34600
like image 178
dyslexicanaboko Avatar answered Sep 19 '22 12:09

dyslexicanaboko