加载此程序集会产生与其他实例异常不同的授权集,而在开始的.netframework网站ninject构造函数中

问题描述 投票:1回答:1

我们有一个.NETFramework 4.7网站,我们在2台Windows服务器server1中发布了与该版本完全相同的版本,即Windows-Server-2016和服务器1可以正常运行,但是我们在服务器2中遇到错误,这是Windows-Server-2012:在启动应用程序时:

[FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)]
  Ninject.Modules.AssemblyChecker.GetAssemblyNames(IEnumerable`1 fileNames, Predict`1 filter) +0
  Ninject.Modules.AssemblyNameRetriever.GetAssemblyNames(IEnumerable`1 fileNames, Predict`1 filter) +164
  Ninject.Modules.CompiledModuleLoaderPlugin.LoadModules(IEnumerable`1 fileNames) +87
  Ninject.Module.ModuleLoader.LoadModules(IEnumerable`1 patterns) +381
  Ninject.KernelBase.Load(IEnumerable`1 filePatterns) +44
  Ninject.KernelBase..ctor(IComponentContainer components, INinjectSettings settings, INinjectModule[] Modules) +406
  Ninject.KernelBase..ctor(INinjectModule[] modules) +99
  MyWebSite.Application_Start() in C:\...\Global.asax.cs 70

这是我收到错误的行:

public static IKernel CreateKernel()
{
    try
    {
        ServicePointManager.SecurityProtocol =
            SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

        if (_kernel != null)
            return _kernel;

        var kernel = new StandardKernel();
        kernel.Load(Assembly.GetExecutingAssembly());
        //...
    }
}

我在服务器2中缺少的应用程序与服务器1中的应用程序完全相同,相同的软件包相同的构建相同的环境。有什么主意吗?

asp.net dependency-injection .net-4.0 ninject
1个回答
0
投票

一些研究思路:

© www.soinside.com 2019 - 2024. All rights reserved.