问题
I have ASP.Net 4.5 MVC site. I have hosted my site on shared server, but everytime I create subdomain or domain I get the below error
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.
I am NOT asking here what shoud I do to fix this error,that I know.
But my question is
- What kind of operations are causing this Trust Level issue?
- What should I change in my site,so that if trust level is set to medium(other than full), it renders as desired.
回答1:
By default the ASP.NET Trust Level set for websites is a Custom High Level Trust which should be adequate for most ASP.NET websites.
In some circumstances you may find that a higher ASP.NET Trust level is required. If your application requires Full Trust, you can override the trust level at the application level by adding the following to your web.config file.
To place your website in to Full Trust you need to place the code below in to the 'configuration\system.web' section of your website web.config file:-
If your websites web.config file does not have a 'configuration\system.web' section below is an example that includes these sections of the web.config file:-
<configuration>
<system.web>
<trust level="Full" />
</system.web>
</configuration>
You might refer this link for reason of using different trust level:https://msdn.microsoft.com/en-IN/library/tkscy493(v=vs.85).aspx
来源:https://stackoverflow.com/questions/34243111/what-is-the-cause-of-trust-level-issue-in-asp-net-mvc