【问题标题】:Can't load Microsoft.Data.Services.Client exception无法加载 Microsoft.Data.Services.Client 异常
【发布时间】:2017-01-19 16:55:37
【问题描述】:

我有一个在 Azure 中托管为云服务的 MVC 站点。用户使用 AD 帐户通过单点登录登录。

在 chrome 中这工作正常,但是当我通过 IE 访问该网站时,我得到以下信息

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

我不明白相同的服务器端代码如何在不同的浏览器中产生不同的结果。

当我覆盖 System.Security.Claims.ClaimsAuthenticationManager 中的 Authenticate 方法时,似乎会发生错误。

我们这样做是为了检查用户是否具有特定的 AD 角色,如果是,则调用 base.Authenticate,这是引发异常的地方。

堆栈跟踪:

[FileNotFoundException: Could not load file or assembly 'Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
...GraphClaimsAuthenticationManager.Authenticate(String resourceName, ClaimsPrincipal incomingPrincipal) in ...Azure.Helpers\GraphClaimsAuthenticationManager.cs:76
System.IdentityModel.Services.WSFederationAuthenticationModule.SignInWithResponseMessage(HttpRequestBase request) +694
System.IdentityModel.Services.WSFederationAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs args) +103571
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

更新

我想我已经部​​分解决了,Dll 没有被构建到 Azure 云服务包中。 Copy Local 设置为 true,当我在本地构建时它会得到输出。不知道为什么不包括在内。

【问题讨论】:

  • 能否提供异常堆栈?

标签: c# azure azure-active-directory


【解决方案1】:

如果您的项目使用此 dll,请确保您已部署 Microsoft.Data.Services.Client dll。

根据我的理解,覆盖ClaimsAuthenticationManager.Authenticate 不需要这个dll。此错误是服务器端问题,浏览器不会导致此问题,请确保您使用不同的网络浏览器访问同一个应用程序。

【讨论】:

  • 你的第一句话帮助了飞雪,现在只是想弄清楚为什么它没有被部署。
猜你喜欢
  • 2013-10-21
  • 1970-01-01
  • 2015-10-24
  • 1970-01-01
  • 2017-10-12
  • 2013-08-30
  • 2011-08-02
  • 2021-07-24
  • 1970-01-01
相关资源
最近更新 更多