. Advertisement .
..3..
. Advertisement .
..4..
I get the “could not load file or assembly microsoft web infrastructure” issue when trying to upload everything in my localhost wwwroot folder to the server. Here is the detail of the error I got the error message:
Exception information:
Exception type: InvalidOperationException
Exception message: The pre-application start initialization method Start on type RouteDebug.PreApplicationStart threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods)
at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
at RouteDebug.PreApplicationStart.Start()
Please give me some advice to solve this problem.
The cause: I think the cause is that you didn’t include the dll with your project and add a reference to it.
Solution: You can fix this error by:
In Visual Studio, go to Tools/Library Package Manager/Package Manager Console
After performing a Reference Cleaning, it deleted
Microsoft.Web.Infrastructure
but not from the packages.config files. Visual Studio claims it has already been installed, despite the fact that it tried to add it usingPackage Manager Console
.The
packages.config
file was then deleted.The command was again run
Now it works perfectly.