Could not load file or assembly 'ServiceStack' or one of its dependencies. The system cannot find the file specified

会有一股神秘感。 提交于 2021-01-27 15:53:11

问题


I was trying to launch my web application to server,

Server: Vindows Server 2008 R2 Enterprise
IIS version: 7.5
Framework version: 4.0.30319.17929

But the following error appears:

Server Error in '/salavirtual' Application.

Could not load file or assembly 'ServiceStack' 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 'ServiceStack' 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 'ServiceStack' could not be loaded.


 WRN: Assembly binding logging is turned OFF.
 To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
 Note: There is some performance penalty associated with assembly bind failure logging.
 To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:


[FileNotFoundException: Could not load file or assembly 'ServiceStack' or one of its dependencies. The system cannot find the file specified.]
 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +70
 System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +39
 System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +62
 System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +65
 System.Web.Handlers.AssemblyResourceLoader.EnsureHandlerExistenceChecked() +397    
 System.Web.Handlers.AssemblyResourceLoader.IsValidWebResourceRequest(HttpContext context) +12
 System.Web.Security.FormsAuthenticationModule.OnEnter(Object source, EventArgs eventArgs) +158
 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929

回答1:


Sounds like you have .dll/NuGet packages dependency issue.

I'd do a clean build, close VS.NET, delete /packages folder, than re-open VS.NET and rebuild solution to restore all packages. After check /packages folder to make sure all ServiceStack packages have the same version e.g. v4.0.46. If not, upgrade all projects to make sure they reference the same NuGet version.




回答2:


Thanks for your information and quick reply.

Following your answer, I did this steps:

  1. I opened, Tools-->NuGet Package Manager --> Package Manager Console
  2. I selected the project to publish.
  3. I've executed, Uninstall-Package ServiceStack
  4. Then, I've executed Install-Package ServiceStack -Version 3.9.71
  5. Then, when I published the project everything works perfect.

Many thanks for your help



来源:https://stackoverflow.com/questions/32826481/could-not-load-file-or-assembly-servicestack-or-one-of-its-dependencies-the-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!