BinaryFormatter doesn’t work with Medium Trust
If you are planning to host a web app on a hosting platform, be prepared that they may restrict the trust level and certain functions won’t work: http://msdn.microsoft.com/en-us/library/ms998341.aspx
When I first uploaded Xworder to http://www.xworder.com (at GoDaddy), I found that BinaryFormatter refused to work. BinaryFormatter can serialize private members and thus demands ReflectionPermission that is denied in Medium trust. Xworder used binary serialization to load indexes into memory. The only option was to write my own serializer. That sucked, because my indexes are of various generic types, e.g. SortedList<int, HashSet<int>>, SortedList<string, HashSet<int>>, etc.
Anyway, if you need to test your app with Medium Trust, add the following to web.config:
<trust level=”Medium” originUrl=”” />