c# - 无法加载文件或程序集 Microsoft.Practices.ServiceLocation,版本 = 1.3.0.0

标签 c# asp.net .net visual-studio-2015 nuget

这是我在运行我的应用程序 (.NET 4.5) 时遇到的错误:

Server Error in '/' Application.

Could not load file or assembly 'Microsoft.Practices.ServiceLocation, Version=1.3.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.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

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.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/Users/Austin/Documents/FileStore/FileStore.Web/
LOG: Initial PrivatePath = C:\Users\Austin\Documents\FileStore\FileStore.Web\bin
Calling assembly : Chicago.Security, Version=1.0.5826.21195, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Austin\Documents\FileStore\FileStore.Web\web.config
LOG: Using host configuration file: C:\Users\Austin\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.3.0.0 redirected to 1.3.0.0.
LOG: Post-policy reference: Microsoft.Practices.ServiceLocation, Version=1.3.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.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   Chicago.Security.AuthenticationModule.application_AuthenticateRequest(Object sender, EventArgs e) +0
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

我安装了 nuget 包 CommonServiceLocator,但我仍然收到此错误。奇怪的是,我的 web.config 文件中有一个程序集绑定(bind)重定向,但该程序集没有出现在我的项目的引用列表中,我无法在任何地方找到它来添加它。我对 ASP.NET 还是比较陌生,所以我似乎无法确定到底是什么问题。我发现要尝试的另一件事是在 IIS 管理器中为我的应用程序池将“启用 32 位应用程序”设置为 true,但这并没有解决我的问题。我已经坚持了一段时间,所以任何帮助将不胜感激。

最佳答案

经过数小时的研究和尝试不同的事情,从 Nuget 卸载并重新安装 CommonServiceLocator 似乎可以解决问题。我仍然对 .NET 应用程序及其依赖项的困惑程度感到惊讶。

关于c# - 无法加载文件或程序集 Microsoft.Practices.ServiceLocation,版本 = 1.3.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35435774/

相关文章:

c# - 如何使用 EF 4.3 迁移运行一系列 sql 脚本?

c# - 基于 ListView 做以下想法是一种好习惯吗?

c# - 即使项目生成,Visual Studio 也会显示错误

asp.net - MS Web Deploy 跳过删除规则不跳过

asp.net - 通过 ASP.net Web 应用程序将名称插入 MySql 数据库

.net - 覆盖 GetHashCode 的最佳算法是什么?

c# - 在 native iOS/Android 应用程序中使用 Xamarin 库

c# - 什么是NullReferenceException,如何解决?

c# - 发布到 MVC6 Controller 的值为空

asp.net - 如何让 JQuery 智能感知在 aspx 文件中工作?