There. I said it. Medium Trust is PITA. I wont be surprised if someone replies with one of the following:
“Well, not really, you only have to do x, y and z and your code is compatible with medium trust environments”
or
“It’s there (Medium Trust) because code needs boundaries within controlled scenarios such as hosting environments.. “
Blah. Blah. Blah. You’re both right. However, it’s still a PITA. Why? In the past 4 months I’ve spent countless hours figuring out why my app is broken in a medium trust environment. I use certain tools to make my life easier (such as Castle Active Record, Windsor, ASP.NET MVC, Spark, etc) yet a lot of them assume full trust. They do have options to get them running under partial/medium trust but in my experience the debugging of these tools in said environments sucks.
Needless to say, I just got done debugging for 2.5 hours why my Spark MVC site would not precompile my views. The error was “No Input could be found". WTH!?! Finally, after walking through my app line by line I found the following in a Spark view:
${Html.ActionLink("Track Admin", "index", new { controller = "track" })} ${Html.ActionLink("Speaker Admin", "index" , new {controller="speaker"})}
The problem is that I had deleted those controllers and moved that part of the app. Once I removed the code, it recompiled fine. Completely frustrating and the root cause of this is Medium trust. I just spent 2.5 hours working on a debugging issue for Medium trust when I could be creating my app for a mobile start up company that I’m heading up.
Long story short : I’m not a fan of Medium Trust. I don’t know many people who are.
How Can we Get Around It?
I’m not sure we can in the .NET space. Other dynamic languages don’t seem to have these issues, but they do run into odd edge cases at runtime which can be even more of a pain to handle. So at this point, the only answer I have is to recommend any open source or commercial vendor to test their product on a lock down medium trust environment and provide very clear and concise instructions for how to get their product to run under medium trust.
Justin Chase says
I don't think anyone likes medium trust. Unfortunately if you buy shared hosting (the cheap stuff) that's how they securely separate AppDomains. It's lame but the solution is to buy the full virtual server, which is 10 times more expensive.
larrydukek says
I am with you, and I have spent many hours debugging medium trust issues. Most of which have come about since Visual Studio 2010 released. Spark View Engine 1.1, which works with MVC 2.0 is causing me all sorts of issues due to it's need to be precompiled to run in medium trust.
Has anybody got this working yet?
Donn Felker says
I have it working in medium trust on Rack Space Cloud servers. I'm
precompiling as a build step. I followed the sample in the Spark samples
directory for medium trust.
Good luck!
larrydukek says
I had it working on the 3.5 framework with MVC and spark with precompiled views. But once I installed VS 2010 and switched to MVC 2.0 with Spark 1.1 while still targeting the 3.5 framework, my hosting service hasn't updated to 4.0 yet, it throws the security permission errors. I tried MVC 2.0 without spark and it works fine, so it appears to be within Spark 1.1, it is almost as though it isn't actually using the precompiled views.
So the code you have on Rack Space Cloud servers, is that MVC2 with Spark 1.1 while targeting a 3.5 framework?
Donn Felker says
I am not running 1.1 on the servers yet. I'm still running 1.0 stuff until I
need to upgrade the app. I have not tried 1.1 in a medium trust scenario
yet. Sorry!
larrydukek says
I got it working, there is a subtle difference in how you tell the view engine about the compiled view assembly. Originally I had it setting Application[“ViewEngine”], which worked in 1.0, but now I set it like this.
var factory = new SparkViewFactory();
factory.Engine.LoadBatchCompilation(Assembly.Load(“Website.Views”));
ViewEngines.Engines.Add(factory);
I hope this will save someone else the time I have wasted. This solution not only works but I think it is a better way of setting the compiled views.
– Duke
air jordan shoes says
Mark S. is definitely on the right track. If you want to get a professional looking email address, Id recommend buying your name domain name, like or
ajf 6
If its common it might be difficult to get, however, be creative and you can usually find something.
Chanel bags says
Armitage, who coach outlet online is yet to register Burberry Scarf a try in this year’s tournament, is Coach Outlet the second England player Chanel bags to receive a ban, after lock Courtney Lawes received Louis Vuitton Shop a two-match suspension for Handbags Outlets recklessly striking an opponent during a clash Coach Purse with Argentina.It has been Gucci Shoes a controversial campaign for England, with two members of Prada Handbags coach Martin Johnson’s staff not allowed to be on the ground for their crucial Christian Louboutin Shoes win over Scotland after being found guilty of illegally tiffany rings switching balls Moncler Sale in their previous match against Romania.On Estebanez, a statement the north face outle on the four-yearly competition’s official website read: “Estebanez was suspended by Independent Judicial Officer Christopher Quinlan QC (England) in accordance with the Rugby World Cup 2011 Disciplinary process.
moncler louis vuitton shop says
Bienvenue
au magasin de sortie Doudoune
Moncler et faire du shopping ici! Nous nous engageons
tous les clients d’avoir les qualités supérieures et des prix bas. Au magasin
Manteaux
Moncler 2011, tous à la mode Veste
Moncler est supérieure de matériau et de fabrication
excellente. Il est certainement approprié pour vous. Il suffit d’acheter pour
vous ou vos amis. Nous fournissons toutes sortes de Doudoune Moncler Pas Cher pour s’adapter aux goûts
différents. Moncler Pas Cher est la même dans d’excellentes
qualité et raisonnable dans le prix, donc n’ont pas besoin de s’inquiéter rien.
Tous les clients peuvent facilement récupérer leur favori Manteaux Moncler,
serviette, portefeuilles, chaussures, chapeaux, foulards, bijoux et lunettes de
soleil.
Wholesale Jerseys says
The colors, logo as well as name of your association, player and also the company written to the jerseys enable them having a separate name. To try to remember a physical activities personality jacket number is probably more as compared with sufficient. Mostly remember that it is seen the fact that sports individualities present their jerseys recommended to their fans.
help with research paper says
I think all these ideas are quite easy to understand and I wonder why I’ve never thought thus.
Coach Outlet Online says
http://www.mycoachoutletstoreonline.com
Cheap authentic NFL jerseys says
You will find 2011 Pro Bowl Jerseys is the best resource for the best deals on everything Internet makert. While the Cheap authentic NFL jerseys can be difficult to find. That’s for there so as tons of imitators as well as knock offs currently available. The good information is that you can easily spot the difference from a cutting-edge cheap Washington Redskins Jerseys along with a knock off, before you decide to shell out the money and now it’s as well late. Keep these ideas in your mind when you’re buying authentic NFL jerseys to ensure you end up with the genuine article.All trustworthy Wholesale Cheap authentic NFL jerseys tend to be manufessentired by Reebok. That’s the underside line, some additional breast supportnd title clwanting to haudio-videoe brand new trustworthy cheap New York Jets Jerseys is actually feeding you is. Reebok hwith respect to exclusive license bringitionallyy’re the only real legit source with this era.
Coach Factory Outlet says
http://buycoachfactoryoutletsz.com