1

I'm trying to deploy the default MVC project (from Visual Studio 2013) onto a remote server. They require the program to be running in Medium Trust mode, which I am having issues with. I've added <trust level="Medium" originUrl="" /> to the <system.web> section of Web.config. Then when I try to run the program on my local machine, a SecurityException is thrown by this line:

@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })

This is located in the _Layout.cshtml file, which I haven't modified from the generated template (when you create a new MVC 5 project).

My question is: what do I need to do to get my project to run in Medium Trust mode?

4
  • Have a look at this answer. It also appears that the [assembly: AllowPartiallyTrustedCallers] attribute has been removed in MVC5 which is probably the cause of the exception in the html helper Commented Aug 17, 2014 at 8:00
  • 1
    MS have also stated in known issues that "ASP.NET MVC 5 no longer supports partial trust...." (perhaps time for a new hosting provider?) Commented Aug 17, 2014 at 8:08
  • Sigh, thanks. You're the first person who's been able to give me that reason. If you post that as an answer I'll mark it as the answer. Commented Aug 17, 2014 at 12:03
  • Possible duplicate of Is trying to develop for Medium Trust a lost cause? Commented Aug 9, 2017 at 9:00

1 Answer 1

6

The current versions of ASP.NET now only support full trust. MS have stated in Release Notes: Known Issues that:

ASP.NET MVC 5 no longer supports partial trust....

In particular the [assembly: AllowPartiallyTrustedCallers] attribute has been removed from the source code. You can read more about ASP.NET's official position in Levi's answer to is-trying-to-develop-for-medium-trust-a-lost-cause, which also includes further links to why support has been removed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.