无法加载文件或程序集System.Net,版本= 2.0.5.0

时间:2016-12-13 17:45:16

标签: c# .net assembly-binding-redirect

我有一个加载Microsoft.Azure.ActiveDirectory.GraphClient库的ASP.NET 4.5.2应用程序。当它尝试连接时,会发生以下错误:

  

System.IO.FileNotFoundException:无法加载文件或程序集'System.Net,Version = 2.0.5.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e'或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。

  File Name: "System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"
   bei System.Data.Services.Client.UriResolver.ConvertToAbsoluteUri(Uri baseUri)
   bei System.Data.Services.Client.UriResolver.ConvertToAbsoluteAndValidateBaseUri(Uri& baseUri, String parameterName)
   bei System.Data.Services.Client.DataServiceContext..ctor(Uri serviceRoot, DataServiceProtocolVersion maxProtocolVersion, ClientEdmModel model)
   bei Microsoft.Azure.ActiveDirectory.GraphClient.Extensions.DataServiceContextWrapper..ctor(Uri serviceRoot, DataServiceProtocolVersion maxProtocolVersion, Func`1 accessTokenGetter, IEnumerable`1 customTypeMappings)
   bei Microsoft.Azure.ActiveDirectory.GraphClient.ActiveDirectoryClient..ctor(Uri serviceRoot, Func`1 accessTokenGetter,...

我已经在我的web.config中添加了绑定重定向:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net" publicKeyToken="7cec85d7bea7798e" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-2.0.5.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

但问题仍然存在。这有什么不对?

0 个答案:

没有答案