It looks like you are using some MVC 4 DLLs.
Note, as a side effect of this you cannot use 4.0 and 5.0 assemblies in the same application. You need to update all of them to 5.0.
Likely you need to look and see which assemblies are trying to be loaded as 4 versions.
The reason this is a problem is the MVC 4 assemblies are attributed with AllowPartialTrustedCallers
, however the MVC 5 assemblies do not.
Since the MVC 5 DLL has a base class for the MVC 4 DLL, the MVC 4 DLL needs to have the same or more restrictive permissions on its classes. Since it does not (which is why this was a breaking change) the security system fails.
Also note that this is a runtime error partially due to the fact that the built versions did not have this issue (you are effectively swapping in a new base class).