从Visual Studio 2017访问Azure数据工厂:Connection正在尝试使用旧版本的Newtonsoft.Json [英] Accessing Azure Data Factory from Visual Studio 2017: Connection is trying to use an old version of Newtonsoft.Json

查看:88
本文介绍了从Visual Studio 2017访问Azure数据工厂:Connection正在尝试使用旧版本的Newtonsoft.Json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




无法加载文件或程序集'Newtonsoft.Json,Version = 6.0.0.0


这是asp.net C#代码:


var context = new AuthenticationContext(" https://login.windows.net/" + tenantID);

ClientCredential cc = new ClientCredential(applicationId,authenticationKey);

        AuthenticationResult result = context.AcquireTokenAsync(" https://management.azure.com/",cc).Result;

        ServiceClientCredentials cred = new TokenCredentials(result.AccessToken);

        var client = new DataFactoryManagementClient(cred){SubscriptionId = subscriptionId};

        string parameters ="" ;;

        client.Pipelines.CreateRunWithHttpMessagesAsync(resourceGroup,dataFactoryName,pipelineName,parameters);



以下是完整的错误消息:


程序集加载跟踪:  以下信息可以有助于确定为什么装配'Newtonsoft.Json,Version = 6.0.0.0,Culture = neutral,
PublicKeyToken = 30ad4fe6b2a6aeed'无法加载。











 === pre-bind sta te information === 
LOG:DisplayName = Newtonsoft.Json,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed
(完全指定)
日志:Appbase =文件:/ // C:/ Users / Walter / Documents / MeSH / Website / 11_27_2018_toLive /
LOG:Initial PrivatePath = C:\ Users\Walter \Documents\MeSH\Website \ _11_27_2018_toLive\bin
调用程序集:Microsoft.Rest.ClientRuntime.Azure,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35。
===
日志:此绑定在默认加载上下文中启动。
日志:使用应用程序配置文件:C:\ Users \ Walter \Documents\MeSH \Website \11_27_2018_toLive \web.config
日志:使用主机配置文件:C:\\ \\ Users\wewal \OneDrive\Documents\IISExpress\config\aspnet.config
日志:使用来自C:\ Windows \ Microsoft.NET.NET \ Framework \v4的计算机配置文件。 0.30319\config\machine.config。
日志:政策后参考:Newtonsoft.Json,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed
日志:尝试下载新的URL文件:/// C:/ Users / wewal / AppData / Local / Temp / Temporary ASP.NET Files / vs / dc6ad0ee / 858c59c1 / Newtonsoft.Json.DLL。
日志:尝试下载新的URL文件:/// C:/ Users / wewal / AppData / Local / Temp / Temporary ASP.NET Files / vs / dc6ad0ee / 858c59c1 / Newtonsoft.Json / Newtonsoft.Json.DLL 。
日志:尝试下载新的URL文件:/// C:/Users/Walter/Documents/MeSH/Website/11_27_2018_toLive/bin/Newtonsoft.Json.DLL。
WRN:比较程序集名称导致不匹配:主要版本
ERR:无法完成程序集的设置(hr = 0x80131040)。探测已终止。




以下是来自web.config的行:


  &NBSP; &NBSP; < dependentAssembly>

  &NBSP; &NBSP; &NBSP; < assemblyIdentity name =" Newtonsoft.Json"公钥=" 30ad4fe6b2a6aeed"培养= QUOT;中性" />

  &NBSP; &NBSP; &NBSP; < bindingRedirect oldVersion =" 0.0.0.0-12.0.0.0" NEWVERSION = QUOT; 12.0.0.0" />

  &NBSP; &NBSP; < / dependentAssembly>


bin文件夹中的DLL是12.01,我找不到调用旧版6.0的Newtonsoft.Json 。


解决方案

嗨Walter,


这个主题的最佳答案可能就是这个诀窍:


https://stackoverflow.com/questions/22507189/could-not-load-file-or-assembly-newtonsoft-json-version- 4-5-0-0-culture-neutr


版本不同,但同样的推理可能适用于您的场景。




Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0

Here is the asp.net C# code:

var context = new AuthenticationContext("https://login.windows.net/" + tenantID);
ClientCredential cc = new ClientCredential(applicationId, authenticationKey);
        AuthenticationResult result = context.AcquireTokenAsync("https://management.azure.com/", cc).Result;
        ServiceClientCredentials cred = new TokenCredentials(result.AccessToken);
        var client = new DataFactoryManagementClient(cred) { SubscriptionId = subscriptionId };
        string parameters = "";
        client.Pipelines.CreateRunWithHttpMessagesAsync(resourceGroup, dataFactoryName, pipelineName, parameters);

Here is the full error message:

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
 (Fully-specified)
LOG: Appbase = file:///C:/Users/Walter/Documents/MeSH/Website/11_27_2018_toLive/
LOG: Initial PrivatePath = C:\Users\Walter\Documents\MeSH\Website\11_27_2018_toLive\bin
Calling assembly : Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Walter\Documents\MeSH\Website\11_27_2018_toLive\web.config
LOG: Using host configuration file: C:\Users\wewal\OneDrive\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
LOG: Attempting download of new URL file:///C:/Users/wewal/AppData/Local/Temp/Temporary ASP.NET Files/vs/dc6ad0ee/858c59c1/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL file:///C:/Users/wewal/AppData/Local/Temp/Temporary ASP.NET Files/vs/dc6ad0ee/858c59c1/Newtonsoft.Json/Newtonsoft.Json.DLL.
LOG: Attempting download of new URL file:///C:/Users/Walter/Documents/MeSH/Website/11_27_2018_toLive/bin/Newtonsoft.Json.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Here is the line from web.config:

      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>

The DLL in the bin folder is 12.01 and I cannot find what is calling the old 6.0 version of Newtonsoft.Json.

解决方案

Hi Walter,

The top answer in this thread might do the trick:

https://stackoverflow.com/questions/22507189/could-not-load-file-or-assembly-newtonsoft-json-version-4-5-0-0-culture-neutr

The version is different but the same reasoning might apply to your scenario.



这篇关于从Visual Studio 2017访问Azure数据工厂:Connection正在尝试使用旧版本的Newtonsoft.Json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆