Compiling an MVC application for a medium level of trust

I am trying to deploy an ASP.NET MVC4 site to a HostGator host. I am having problems when their technical support tells me that I need to compile the application for security.

As far as I can tell, the only way to set the trust level for an application is to set <trust level="Medium"> either in machine.config or web.config. Am I not mistaken in this, is there any other way to compile my application for reliable trust?

based on my initial assumption and the information I found on this page I added a level of trust to my web.config:

By default, web applications run with full trust and unlimited permissions. To change the security trust levels for code access in ASP.NET, you must select the switch in the Machine.config file or the Web.config file at the application level and configure the application as a partial trust application. I set the trust level in my web.config and get this error message from the host:

Parser error message: this configuration section cannot be used in this way. This occurs when a site administrator has blocked access to this section using an inherited configuration file.

However, HostGator still insists that I am compiling for medium trust, does anyone have any advice for me on this?

+8
c # asp.net-mvc-4 medium-trust
source share
1 answer

You're right. You can change the web.config trust settings to Medium. However, you may have some assemblies that do not work in partial trust mode (for example, some IoC containers).

The only way to know for sure is to run it and find out.

+1
source share

All Articles