部署 ASP.NET MVC 项目 [英] Deploying ASP.NET MVC Project

查看:30
本文介绍了部署 ASP.NET MVC 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将默认 MVC 项目(来自 Visual Studio 2013)部署到远程服务器上.他们要求程序在中等信任模式下运行,我遇到了问题.我已将 添加到 Web.config 的 部分.然后当我尝试在本地机器上运行程序时,这一行抛出了一个SecurityException:

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

它位于 _Layout.cshtml 文件中,我没有从生成的模板中修改它(当你创建一个新的 MVC 5 项目时).

我的问题是:我需要做什么才能让我的项目在中等信任模式下运行?

解决方案

ASP.NET 的当前版本现在仅支持完全信任.MS 在发行说明:已知问题中指出:

<块引用>

ASP.NET MVC 5 不再支持部分信任......

特别是 [assembly: AllowPartiallyTrustedCallers] 属性已从源代码中删除.您可以在 Levi 对 is-trying-to-develop-for-medium-trust-a-lost-cause,其中还包括进一步链接,说明支持已被删除的原因.

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?

解决方案

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.

这篇关于部署 ASP.NET MVC 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆