我实现了一个与aspnetboilerplate document完全相同的自定义ExternalLogin:
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>();
}
}
但在运行项目后,我与以下异常交叉:
没有找到支持Abp.Zero.Configuration.IAbpZeroConfig服务的组件
当我添加Abp.Zero.Common.dll
时,我会得到以下错误:
类型'DefaultExternalAuthenticationSource'存在于'Abp.Zero.Common,Version = 3.4.0.0,Culture = neutral,PublicKeyToken = null'和'Abp.Zero,Version = 1.3.1.0,Culture = neutral,PublicKeyToken = null'
如果我删除了Abp.Zero.dll
,我会得到另一个例外。
项目类型是ASP.Net MVC 5
任何帮助都将得到真正的赞赏。
UPDATE1:
定义绑定后如下:
<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',因为它具有要满足的依赖项。
'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]]'未注册。
所以经过一些搜索,我得出这个结论,我必须实现IRepository
并将其注册为(只是为了运行):
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"));
但不幸的是我遇到了新的问题:
你调用的对象是空的。
和Stack的一部分:
[NullReferenceException:对象引用未设置为对象的实例。] Ab:Doith.Uow.UnitOfWorkDefaultOptionsExtensions.GetUnitOfWorkAttributeOrNull(IUnitOfWorkDefaultOptions unitOfWorkDefaultOptions,MethodInfo methodInfo)在D:\ Github \ aspnetboilerplate \ src \ Abp \ Domain \ Uow \ UnitOfWorkDefaultOptionsExtensions.cs中:11:Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation)在D:\ Github \ aspnetboilerplate \ src \ Abp \ Domain \ Uow \ UnitOfWorkInterceptor.cs:32 Castle.DynamicProxy.AbstractInvocation.Proceed()+443 Castle.Proxies .IRepository
2Proxy_1.GetAllListAsync(Expression
1谓词)+155 Abp.Configuration.d__3.MoveNext()在D:\ Github \ aspnetboilerplate \ src \ Abp.Zero.Common \ Configuration \ SettingStore.cs:40 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()+ 31
为什么它很复杂,我在每一步都遇到了新的例外。
UPDATE2:
如果我通过bg
禁用Configuration.BackgroundJobs.IsJobExecutionEnabled = false;
工作,我得到另一个例外如下:
无法创建组件'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]]'因为它具有要满足的依赖性。
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]]'正在等待以下依赖项: - Service'Abp.Domain.Repositories.IRepository 1 [[x.Web。 x.Core.Tenant,x.Web.x.Core,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null]]'未注册。
将[DependsOn(typeof(AbpZeroCommonModule))]
添加到您的模块:
[DependsOn(typeof(AbpZeroCommonModule))]
public class ImmenseWebModule : AbpModule
{
// ...
}
程序集“Abp.WebApi.Validation.AbpApiValidationFilter”中的方法'ExecuteActionFilterAsync'来自程序集'Abp.Web.Api,Version = 3.4.0.0,Culture = neutral,PublicKeyToken = null'没有实现。
添加这些绑定:AbpCompanyName.AbpProjectName.WebMpa/Web.config#L46-L261
问题#2494中提到此绑定有助于:
<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>