找不到支持服务Abp.Zero.Configuration.IAbpZeroConfig的组件 [英] No component for supporting the service Abp.Zero.Configuration.IAbpZeroConfig was found

查看:537
本文介绍了找不到支持服务Abp.Zero.Configuration.IAbpZeroConfig的组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了与 aspnetboilerplate文档完全相同的自定义外部登录:

I implemented a custom ExternalLogin exactly like aspnetboilerplate document:

public class MyExternalAuthSource : DefaultExternalAuthenticationSource<Tenant, User>, ITransientDependency
{
    public override string Name
    {
        get { return "MyCustomSource"; }
    }

    public override Task<bool> TryAuthenticateAsync(string userNameOrEmailAddress, string plainPassword, Tenant tenant)
    {

    }
}

我将其注册为:

public class ImmenseWebModule : AbpModule
{
    public override void PreInitialize()
    {
        Configuration.Modules.Zero().UserManagement.ExternalAuthenticationSources.Add<MyExternalAuthSource>();
    }
}

但是在运行项目后,我遇到了以下异常:

but after running project I crossed with below exception:

未找到支持服务Abp.Zero.Configuration.IAbpZeroConfig的组件

No component for supporting the service Abp.Zero.Configuration.IAbpZeroConfig was found

当我添加Abp.Zero.Common.dll时,我将得到以下错误:

When I added Abp.Zero.Common.dll I will get below error:

类型'DefaultExternalAuthenticationSource'在'Abp.Zero.Common,Version = 3.4.0.0,Culture = neutral,PublicKeyToken = null'和'Abp.Zero,Version = 1.3.1.0,Culture = neutral,PublicKeyToken =空"

The type 'DefaultExternalAuthenticationSource' exists in both 'Abp.Zero.Common, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null' and 'Abp.Zero, Version=1.3.1.0, Culture=neutral, PublicKeyToken=null'

如果我删除了Abp.Zero.dll,我将获得另一个例外.

If I removed Abp.Zero.dll I will get another exceptions.

项目类型为ASP.Net MVC 5

任何帮助将不胜感激.

UPDATE1:

定义如下所示的绑定后:

After defining a binding as below :

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>

我有一个例外:

无法创建组件'Abp.BackgroundJobs.BackgroundJobStore',因为它具有要满足的依赖关系.

Can't create component 'Abp.BackgroundJobs.BackgroundJobStore' as it has dependencies to be satisfied.

'Abp.BackgroundJobs.BackgroundJobStore'正在等待以下依赖项: -服务'Abp.Domain.Repositories.IRepository`2 [[Abp.BackgroundJobs.BackgroundJobInfo,Abp,Version = 3.4.0.0,Culture = neutral,PublicKeyToken = null],[System.Int64,mscorlib,Version = 4.0.0.0, Culture = neutral,PublicKeyToken = b77a5c561934e089]]',但尚未注册.

'Abp.BackgroundJobs.BackgroundJobStore' is waiting for the following dependencies: - Service 'Abp.Domain.Repositories.IRepository`2[[Abp.BackgroundJobs.BackgroundJobInfo, Abp, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.

因此,经过一番搜索,我得出了一个结论,我必须实现IRepository并将其注册为(只为运行):

So after some search I came to this conclusion that I have to implement IRepository and register it as(just to be run):

public interface ISampleBlogRepository<TEntity, TPrimaryKey> : IRepository<TEntity, TPrimaryKey>
    where TEntity : class, IEntity<TPrimaryKey>
{

}

并注册:

IocManager.IocContainer.Register(Component.For(
                typeof(IRepository<>))
                    .ImplementedBy(typeof(ISampleBlogRepository<>)).LifestyleTransient().Named("IRepositoryImplementation"));
            IocManager.IocContainer.Register(Component.For(
                typeof(IRepository<,>))
                    .ImplementedBy(typeof(ISampleBlogRepository<,>)).LifestyleTransient().Named("IRepositoryOfPrimaryKeyImplementation"));

但不幸的是,我遇到了新问题:

But unfortunately I faced new problem as :

对象引用未设置为对象的实例.

Object reference not set to an instance of an object.

和堆栈的一部分:

[NullReferenceException:对象引用未设置为对象的实例.] Abp.Domain.Uow.UnitOfWorkDefaultOptionsExtensions.GetUnitOfWorkAttributeOrNull(IUnitOfWorkDefaultOptions unitOfWorkDefaultOptions,MethodInfo methodInfo)在D:\ Github \ aspnetboilerplate \ src \ Abp \ Domain \ Uow \ UnitOfWorkDefaultOptionsExtensions.cs:11 D:\ Github \ aspnetboilerplate \ src \ Abp \ Domain \ Uow \ UnitOfWorkInterceptor.cs:32中的Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation调用) Castle.DynamicProxy.AbstractInvocation.Proceed()+443 Castle.Proxies.IRepository 2Proxy_1.GetAllListAsync(Expression 1谓词)+155 D:\ Github \ aspnetboilerplate \ src \ Abp.Zero.Common \ Configuration \ SettingStore.cs:40中的Abp.Configuration.d__3.MoveNext() System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()+31

[NullReferenceException: Object reference not set to an instance of an object.] Abp.Domain.Uow.UnitOfWorkDefaultOptionsExtensions.GetUnitOfWorkAttributeOrNull(IUnitOfWorkDefaultOptions unitOfWorkDefaultOptions, MethodInfo methodInfo) in D:\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkDefaultOptionsExtensions.cs:11 Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:32 Castle.DynamicProxy.AbstractInvocation.Proceed() +443 Castle.Proxies.IRepository2Proxy_1.GetAllListAsync(Expression1 predicate) +155 Abp.Configuration.d__3.MoveNext() in D:\Github\aspnetboilerplate\src\Abp.Zero.Common\Configuration\SettingStore.cs:40 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31

为什么这么复杂,我在每个步骤中都面临着新的例外.

UPDATE2:

如果通过Configuration.BackgroundJobs.IsJobExecutionEnabled = false;禁用bg作业,我将收到另一个异常,如下所示:

If I disable bg jobs by Configuration.BackgroundJobs.IsJobExecutionEnabled = false; I got another exception as below:

无法创建组件'Abp.MultiTenancy.TenantCache 2 [[x.Web.x.Core.Tenant,x.Web.x.Core,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null], [MARCO.Web.ImmenseLib.Core.User,x.Web.x.Core,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null]]",因为它具有要满足的依赖性.

Can't create component 'Abp.MultiTenancy.TenantCache 2[[x.Web.x.Core.Tenant, x.Web.x.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MARCO.Web.ImmenseLib.Core.User, x.Web.x.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' as it has dependencies to be satisfied.

Abp.MultiTenancy.TenantCache 2 [[x.Web.x.Core.Tenant,x.Web.x.Core,版本= 1.0.0.0,区域性=中性,PublicKeyToken =空],[x.Web.x .Core.User,x.Web.x.Core,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null]]'正在等待以下依赖项: -服务'Abp.Domain.Repositories.IRepository 1 [[x.Web.x.Core.Tenant,x.Web.x.Core,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null]]',该服务不是已注册.

Abp.MultiTenancy.TenantCache 2[[x.Web.x.Core.Tenant, x.Web.x.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[x.Web.x.Core.User, x.Web.x.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' is waiting for the following dependencies: - Service 'Abp.Domain.Repositories.IRepository 1[[x.Web.x.Core.Tenant, x.Web.x.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

推荐答案

在模块中添加[DependsOn(typeof(AbpZeroCommonModule))]:

[DependsOn(typeof(AbpZeroCommonModule))]
public class ImmenseWebModule : AbpModule
{
    // ...
}

程序集"Abp.Web.Api"中类型为"Abp.WebApi.Validation.AbpApiValidationFilter"的方法"ExecuteActionFilterAsync",版本= 3.4.0.0,Culture = neutral,PublicKeyToken = null,没有实现.

Method 'ExecuteActionFilterAsync' in type 'Abp.WebApi.Validation.AbpApiValidationFilter' from assembly 'Abp.Web.Api, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

添加以下绑定: AbpCompanyName.AbpProjectName.WebMpa/Web.config#L46-L261

在问题#2494 中提到此绑定有帮助:

It is mentioned in issue #2494 that this binding helps:

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="B03F5F7F11D50A3A" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>

这篇关于找不到支持服务Abp.Zero.Configuration.IAbpZeroConfig的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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