簡體   English   中英

無法加載文件或程序集“ Microsoft.Data.Service”或其依賴項之一。 該系統找不到指定的文件

[英]Could not load file or assembly 'Microsoft.Data.Service' or one of its dependencies. The system cannot find the file specified

我剛切換計算機,但我的項目之一無法正常運行,並在標題中引發了錯誤。 (您可能還會在下面找到完整的錯誤消息)顯然是在尋找錯誤的位置,但是目前我不確定要更改什么。 請指教。

請記住一些事實

  • 我沒有更改源代碼中的任何代碼行
  • 在由VSTS部署的新生產服務器上運行正常
  • 我正在使用IISExpress來運行它
  • 我正在使用Visual Studio 2015 v14.0.25431.01更新3
  • 與我的上一台計算機的主要區別之一是該計算機上裝有Visual Studio 2017 RC (我不認為這是什么原因,但誰知道呢)

程序和特點

存在以下申請

  • WCF數據服務5.6.3工具

Bin目錄

存在以下文件

  • Microsoft.Data.Edm.dll
  • Microsoft.Data.OData.dll
  • Microsoft.Data.Services.Client.dll
  • Microsoft.Data.Services.dll

DataService.svc (完整)

<%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory, Microsoft.Data.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Service="Company.Project.Services.DataService" %>

Web.Config (部分)

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Data.Services" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-5.7.0.0" newVersion="5.7.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

錯誤頁面

“ /”應用程序中的服務器錯誤。

無法加載文件或程序集“ Microsoft.Data.Services,版本= 5.0.0.0,區域性=中性,PublicKeyToken = 31bf3856ad364e35”或其依賴項之一。 該系統找不到指定的文件。

說明:執行當前Web請求期間發生未處理的異常。 請查看堆棧跟蹤,以獲取有關錯誤及其在代碼中起源的更多信息。

異常詳細信息: System.IO.FileNotFoundException:無法加載文件或程序集“ Microsoft.Data.Services,Version = 5.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35”或其依賴項之一。 該系統找不到指定的文件。

源錯誤:

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.

程序集加載跟蹤:以下信息有助於確定為什么無法加載程序集“ Microsoft.Data.Services,版本= 5.0.0.0,區域性=中性,PublicKeyToken = 31bf3856ad364e35”。

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Data.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/Source/github/company/repository/project/HubServices/
LOG: Initial PrivatePath = C:\Source\github\company\repository\project\HubServices\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Source\github\company\repository\project\HubServices\web.config
LOG: Using host configuration file: C:\Users\user\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: 5.0.0.0 redirected to 5.7.0.0.
LOG: Post-policy reference: Microsoft.Data.Services, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

堆棧跟蹤:

[FileNotFoundException: Could not load file or assembly 'Microsoft.Data.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]

[FileNotFoundException: Could not load file or assembly 'Microsoft.Data.Services, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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) +40
   System.Type.GetType(String typeName, Boolean throwOnError) +34
   System.ServiceModel.Activation.ServiceParser.GetType(String typeName) +55
   System.ServiceModel.Activation.ServiceParser.GetCompiledType(Assembly compiledAssembly) +76
   System.ServiceModel.Activation.ServiceParser.CreateParseString(Assembly compiledAssembly) +38
   System.ServiceModel.Activation.ServiceBuildProvider.GetCustomString(CompilerResults results) +33
   System.Web.Compilation.BuildProvider.CreateBuildResult(CompilerResults results) +182
   System.Web.Compilation.BuildProvider.GetBuildResult(CompilerResults results) +16
   System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +10098689
   System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +294
   System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) +103
   System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) +82
   System.Web.Compilation.BuildManager.GetCompiledCustomString(String virtualPath) +31
   System.ServiceModel.HostingManager.GetCompiledCustomString(String normalizedVirtualPath) +163
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +201
   System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +52
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +641

[ServiceActivationException: The service '/DataService.svc' cannot be activated due to an exception during compilation.  The exception message is: Could not load file or assembly 'Microsoft.Data.Services, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +481507
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +174
   System.ServiceModel.Activation.ServiceHttpHandler.EndProcessRequest(IAsyncResult result) +11
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129

我不得不重新打開該項目,意識到程序集不在加載的模塊中 我檢查了為bin\\{Configuration}設置的輸出目錄,將其更改為bin解決了該問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM