I recently wrote. Net mvc4.0ProgramThe following error occurs:
Method not found: "void newtonsoft. JSON. serialization. defaultcontractresolver. set_ignoreserializableattribute (Boolean )".
After repeated debugging, it is found that the newtonsoft. JSON package version is incorrect. After the update, the problem is solved. The following describes the cause and solution of the error.
My development tool is vs2010 and the project is mvc4.0
I. Reasons
When my project was almost done, I had a little free time, so I wanted to take a deeper look at vs2010. By the way, I updated web components, and some components were updated to vs2012. After the update, start to sort out your projects. This is an error that occurs when the program always jumps to routeconfig. CS.Method not found: "void newtonsoft. JSON. serialization. defaultcontractresolver. set_ignoreserializableattribute (Boolean )".It seems that the MVC routing configuration cannot be executed.
Ii. Solution Process
After searching for it online for half a day, it may be newtonsoft. JSON. DLL, so I want to use nuget to compare the new version. It turns out that nuget cannot be used. Well, I went to the nuget release website to update nuget, after updating nuget, newtonsoft is found in my project. JSON is 4.5.1 and the latest version is 4.5.9. It is updated immediately and the final problem is solved.
Iii. Doubts
After the newtonsoft. JSON package is updated, the page can be viewed normally, but the previous error may occur occasionally, but this situation is rare and I don't know why. If you encounter the same problem, contact me to thoroughly investigate this bug.