AspNet Core in .net5.0 applications won't start since BinaryFormatter use is prohibited, as stated here.
Please consider replacing BinaryFormatter with something "AspNet Core in 5.0" friendly.
It's something AspNet Core related, since .net5.0 console applications don't have such an issue.