2
votes

just trying to set up my development environment for ASP.NET MVC, have started a blank ASP.NET MVC project, and have placed the following in my web.config: <trust level="Medium" originUrl=""/>

Running the project then results in the following exception:

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

If possible, I want to develop my app for medium trust, as I don't have a choice where it will be hosted, and the possibility exists that there may be some sort of restrictions with the trust levels.

3
Is there any chance we could see the rest of the call stack? That would let us see which library is requesting Reflection Permission - because I don't think the default ASP.NET MVC stack requires that - things like StructureMap or NHibernate however may do: stackoverflow.com/questions/784666/… - Zhaph - Ben Duguid
I'll review it, but I'm certainly not using StructureMap or NHibernat. This was a clean install of VS 2008 and NET MVC 1.0., with a clean MVC project. - Daniel.S

3 Answers

3
votes

The current version of ASP.NET MVC only support <trust level="Full" /> - refer this answer

1
votes

I can't reproduce this exception on my machine. You should be able to bin deploy ASP.Net MVC in medium trust. I have successfully done it on my host and godaddy. Are you using MVC 1.0? Have you changed or added restrictions to the Medium trust settings, possibly in an inherited web.config or machine.config file?

0
votes

I had a similar error for my website. It worked fine on my localmachine but would throw a permission error on my webhost. I actually just tried setting my web.config to...

<trust level="Full" />

and it worked fine for me. I didn't think it would work but it did.