Method not found: 'Newtonsoft.Json.JsonSerializerSettings Microsoft.AspNet.Mvc.MvcJsonOptions.get_SerializerSettings()'

半城伤御伤魂 提交于 2019-12-04 07:47:12

Yes, I just worked all night and did eventually figured it out. Here is what you need to do:

Make sure you install: -Microsoft.AspNet.Mvc.Formatters.Json version "6.0.0-rc1-final" and -Revert Netonsoft.Json to "6.0.6".

Then you can keep this:

services.AddMvc().AddJsonOptions(options =>
    {
        options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
    });

project.json:

"Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-rc1-final", "Newtonsoft.Json": "6.0.6"

I had a bunch of trouble redeploying too but eventually this worked.

Good luck!

Just got off a call with Microsoft support as of yesterday (02 Aug 2016) Azure App Services now only support ASP.NET core, due to a breaking change:

A breaking change was released and anything other than ASP.NET core is not supported, so the only option is an upgrade. The breaking change is being rolled out to all (regions) eventually all your instances will fail.

Is ASP.NET 5, Core RC1, RC2 supported on Azure App Service? NO

https://blogs.msdn.microsoft.com/waws/2016/06/14/supporting-asp-net-5-core-rc1-on-azure-app-service/

Verify your app is running the latest version of ASP.NET Core and not RC1 or RC2.

We were affected (North Europe) and upgraded our app from RC2 and it worked first time.

We also saw this in production, contacted the team and got this out: https://social.msdn.microsoft.com/Forums/en-US/f0a6bbaf-498a-4c1f-b869-6779ee18e04e/app-service-applications-may-experience-methodnotfound-exceptions-due-to-incorrect-newtonsoft-json?forum=windowsazurewebsitespreview

It appears that a fix for App Service is on its way as well. Meanwhile, the linked post contains pretty much the same instructions as the other answers here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!