[英]Azure Function: Could not load file or assembly Newtonsoft.Json
I'm aware that this issue is widely covered on the web and at stackoverflow but I could do with some extra help to sort this issue.我知道这个问题在 web 和 stackoverflow 上得到了广泛的报道,但我可以通过一些额外的帮助来解决这个问题。 I'm getting a runtime error relating to loading Newtonsoft, see below;
我收到与加载 Newtonsoft 相关的运行时错误,见下文;
[11/07/2020 18:37:17] A ScriptHost error has occurred
[11/07/2020 18:37:17] Exception while executing function: Alerts. EmailSender: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. mscorlib: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
[11/07/2020 18:37:17] Exception while executing function: Alerts
[11/07/2020 18:37:17] Exception while executing function: Alerts. EmailSender: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. mscorlib: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
[11/07/2020 18:37:17] Function completed (Failure, Id=850be268-8e38-409d-aa59-fa071567779e, Duration=10672ms)
I have followed and implemented binding redirects as described in this blog .我遵循并实现了本博客中描述的绑定重定向。 My azure function is a verion 1 function with .net472, im using Microsoft.NET.Sdk.Functions Version 1.0.36.
My azure function is a verion 1 function with .net472, im using Microsoft.NET.Sdk.Functions Version 1.0.36.
The exception occurs when a call to a referenced project is made, in that project there is a reference to Newtonsoft 10.0.2.当调用引用的项目时发生异常,在该项目中有对 Newtonsoft 10.0.2 的引用。
Any help is greatly appreciated - thanks!非常感谢任何帮助 - 谢谢!
You'll need to downgrade Newtonsoft to 9.0.1.您需要将 Newtonsoft 降级到 9.0.1。 You'd better read about the v1/v2 breaking changes and rewrite your function to .net core.
您最好阅读有关 v1/v2 重大更改的信息,并将您的 function 重写为 .net 内核。
https://github.com/Azure/app-service-announcements/issues/129 https://github.com/Azure/app-service-announcements/issues/129
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.