简体   繁体   English

尝试通过安全透明方法'system.web.mvc.preapplicationStartcode.start'访问安全关键方法。

[英]Attempt by security transparent method 'system.web.mvc.preapplicationStartcode.start' to access security critcal method.. failed

Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed. 尝试通过安全透明方法'System.Web.Mvc.PreApplicationStartCode.Start()'访问安全关键方法'System.Web.WebPages.Razor.PreApplicationStartCode.Start()'失败。

I am getting the above error when a run a project. 运行项目时出现上述错误。

I have read a few posts on this about downloading a package from nuget but my problem is, is this project is downloaded from our source control and it seems to work on all other machines straight off. 我已经阅读了一些有关从nuget下载软件包的文章,但是我的问题是,这个项目是从我们的源代码控制中下载的,而且似乎可以直接在所有其他机器上运行。 On this new machine it does not. 在这台新机器上没有。 Ideally I don't want to go messing with the project and checking something into the source control that will break it on other machines. 理想情况下,我不想弄乱项目,不要在源代码管理中检查会在其他计算机上破坏它的内容。

The project its self is an old classic asp project with a few .net bits both webforms and a little bit of razor, previously it's been run in VS 2012/2015 and now this new machine has VS 2017. I don't know if this is relevant so my question is: 该项目本身是一个古老的经典ASP项目,带有一些.net位,包括Web窗体和剃须刀,以前它是在VS 2012/2015中运行的,而现在这台新机器是VS2017。我不知道这是否是相关的,所以我的问题是:

Is there anything within the actual "environment" that could be missing rather than within the actual sln/project ? 在实际的“环境”中是否有任何东西会丢失,而不是在实际的sln /项目中

I had a similar problem. 我有一个类似的问题。 My code worked fine on my local PC, fine on Dev, but on the UAT box I got this same error. 我的代码在本地PC上运行正常,在Dev上运行良好,但是在UAT框上,我遇到了同样的错误。

For me the problem was I had the wrong combination of dll versions installed from nuget. 对我来说,问题是我从nuget安装的dll版本组合错误。 I had the System.Web.MVC v4 and System.Web.Pages v3 (which is for MVC 5). 我有System.Web.MVC v4和System.Web.Pages v3(适用于MVC 5)。

My guess is this worked ok locally and in Dev because MVC had been installed and it could find the correct version of the dlls in the GAC. 我的猜测是,这在本地和开发环境中都可以正常进行,因为已经安装了MVC,并且可以在GAC中找到dll的正确版本。

Using System.Web.Mvc v5 fixed the issue for me 使用System.Web.Mvc v5为我解决了此问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试使用安全透明方法'Microsoft.Web.Helpers.PreApplicationStartCode.Start()'来访问安全关键方法 - Attempt by security transparent method 'Microsoft.Web.Helpers.PreApplicationStartCode.Start()' to access security critical method 尝试通过安全透明方法访问安全关键方法失败 - Attempt by security transparent method to access security critical method failed 通过安全透明方法尝试访问安全关键类型失败 - Attempt by security transparent method to access security critical type failed 尝试使用安全透明方法'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()'来访问安全关键 - Attempt by security transparent method 'System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule()' to access security critical 尝试通过安全透明方法'Compat.Button1_Click(System.Object,System.EventArgs)'访问安全关键方法'x'失败 - Attempt by security transparent method 'Compat.Button1_Click(System.Object, System.EventArgs)' to access security critical method 'x' failed System.MethodAccessException:尝试通过安全透明方法访问安全性关键方法在所有应用程序上失败 - System.MethodAccessException: Attempt by security transparent method to access security critical method fails on all applications 通过安全透明方法异常尝试 - Attempt by security transparent method exception ASP.NET MVC3 升级 - “尝试通过方法 [whatever] 访问方法 System.Web.Mvc.Controller.View(...) 失败” - ASP.NET MVC3 upgrade - “Attempt by method [whatever] to access method System.Web.Mvc.Controller.View(…) failed” Attempt by method 'System.Web.Helpers.Json..cctor()' to access method 'System.Web.Helpers.Json.CreateSerializer()' failed - Attempt by method 'System.Web.Helpers.Json..cctor()' to access method 'System.Web.Helpers.Json.CreateSerializer()' failed 无法使用 webclient 方法访问网站..? - Cant access site using webclient method..?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM