无法加载Microsoft.Data.Services.Client异常

时间:2017-01-18 15:43:35

标签: c# azure azure-active-directory

我在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,当我在本地构建时它会输出。不知道为什么它不包括在内。

1 个答案:

答案 0 :(得分:1)

如果您的项目使用了此dll,请确保已部署ClaimsAuthenticationManager.Authenticate dll。

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

相关问题