gpt4 book ai didi

c# - 操作可能会破坏 StructureMap 中的运行时

转载 作者:太空狗 更新时间:2023-10-29 22:37:19 25 4
gpt4 key购买 nike

我在本地计算机上的一个 ASP.NET 4.5 MVC 应用程序中遇到此错误。其他使用 ASP.NET 4.5 设置并使用 StructureMap 的应用程序工作正常。 Error Message

如有任何帮助/解决方案,我们将不胜感激。导致这种情况的代码行是:

using StructureMap;
using StructureMap.Graph;

namespace Management.Web.DependencyResolution
{
public static class IoC
{
public static IContainer Initialize()
{
ObjectFactory.Initialize(x =>
{
x.Scan(scan =>
{
scan.TheCallingAssembly();
scan.WithDefaultConventions();
scan.Assembly("Management.Core");
scan.Assembly("Management.DAL");
scan.Assembly("Management.BusinessServices");
scan.Assembly("Management.Infrastructure");
});
x.For<INavigationService>().Use<NavigationService>();
});
return ObjectFactory.Container;
}
}
}

最佳答案

有一个 .Net 更新解决了这个问题。 KnowledgeBase 2748645

When you use some third-party controls, you may receive a System.Security.VerificationException exception. This issue occurs if the following conditions are true:

The third-party controls use the generic types.

The CLR verifier is enabled by declaring an assembly that is marked as security-transparent.

此问题在 this blog post 中有更详细的描述。 .

The problem exists on the IL level and is only detected when the CLR Verifier is executed on the code. The verifier makes sure that the IL is type safe before it’s sent to the JIT Compiler and if it detects and issue (like this) it will bark at you.

关于c# - 操作可能会破坏 StructureMap 中的运行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23683182/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com