What application trust level is need for ASP.NET MVC framework?

吃可爱长大的小学妹 提交于 2019-12-22 04:45:16

问题


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?


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/791488/what-application-trust-level-is-need-for-asp-net-mvc-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!