What application trust level is need for ASP.NET M

2019-04-25 07:45发布

i am trying to deploy simple asp.net mvc frameworkd application in may shared hosting and i get erro like this:

Security 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.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
http://test.pakabink.lt/

In my control panel i am seting "ASP.NET 2.0 Full Trust". What i need to ask for server administrator to change?

3条回答
Ridiculous、
2楼-- · 2019-04-25 07:50

You should be able to bin deploy and run the MVC framework in medium trust. There is a possibility that there is some other permission that the hosting company has taken away but it should work. Are you testing with the default MVC project? If you are using other components (Structure Map, for example), that may be causing the error.

Check out Bin Deploying ASP.NET MVC from Phil Haack about deploying and the required trust level.

查看更多
手持菜刀,她持情操
3楼-- · 2019-04-25 07:50

Web deploy copies some System.Web dlls to bin folder, for example System.web.MVC but not all. It is kind of lot of debugging to determine which ones are missing, like the previous comment said about reflection methods.

查看更多
太酷不给撩
4楼-- · 2019-04-25 08:17

Medium trust does not allow certain Reflection operations. I guess some part of your code does or calls other part(s) of code.

查看更多
登录 后发表回答