Drawing Blanks

Premature Optimization is a Prerequisite for Success

BinaryFormatter doesn’t work with Medium Trust

leave a comment »

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=”” />

Advertisements

Written by bbzippo

11/10/2009 at 7:34 am

Posted in programming

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: