最近,我决定要集成测试我的WebApi 2应用程序。我决定将应用程序转换为符合OWIN标准的应用程序。我已经包含了所有的NuGet包,并将其与AutoFac中间件连接起来,等等。
但是,当我试图在主要示例程序方法中用HttpClient测试应用程序时,我会得到一个错误:
{
"Message":"An error has occurred.",
"ExceptionMessage":"An error occurred when trying to create a controller of type 'DinnerLi
我仍然是Abp.io的新手,我得到了以下异常。我遵循了Abp.io文档中的说明。你能帮我知道我错过了什么吗? 2019-10-10 14:01:46.644 +03:00 [ERR] An exception was thrown while activating Castle.Proxies.ProcessesServiceProxy.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Castle.Proxies.ProcessesServiceProxy. ---&g
仅当未注册的ILogger在RegisterAggregateService中时才会获得错误
[ComponentNotRegisteredException: The requested service 'Autofac.Extras.NLog.ILogger' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or u
无法使用KeyFilter属性解析asp.net核心web api 2.2中的注册类型
我想使用Autofac来解析一个类型的不同实例。我使用RegisterType().Keyed和RegisterType().Named在Startup.ConfigureServices中注册了类型。
我可以使用IContainer.ResolveKeyed来解析实例,但不能在构造函数中使用KeyFilter来解析实例
启动
public class Startup
{
public Startup(IConfiguration configuration)
创建类型为“UserController”的控制器故障。确保控制器具有无参数的公共构造函数。
使用AutoFac,我注册了UnitOfWork存储库,如下所示,我还粘贴控制器代码和堆栈跟踪。请协助。无法理解为什么控制器需要无参数的公共构造函数。
private static IContainer RegisterServices(ContainerBuilder builder)
{
//Register your Web API controllers.
builder.RegisterApiControllers(
当我试图调用我的项目上的控制器时,我收到了以下错误,该控制器使用oWin和Quartz.Net 3.0.7与Autofac。
{
"Message": "An error has occurred.",
"ExceptionMessage": "An error occurred when trying to create a controller of type 'QuartzController'. Make sure that the controller has a parameterless public con
我有两门课,比如:
public class P
{
public P( Guid g ) {}
}
public class Lp
{
public Lp() {}
public Lp( P p ) {}
}
我在Autofac 6.2.0中注册了这两个程序,如下所示:
builder.RegisterType< P >();
builder.RegisterType< Lp >();
现在,我想使用默认的ctor解析一个Lp。当我试图解析Lp时,比如:
var c = builder.Build();
using( var scop
向控制台API发送post请求时,出现以下异常:
Autofac.Core.DependencyResolutionException
HResult=0x80131500
Message=An exception was thrown while activating TeocoExcel.DataManager.
Source=Autofac
StackTrace:
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters, Ob
我试图将Autofac配置为使用我的Web /Oauth项目,但它似乎不起作用。我一直得到“构造函数上的不能解析参数ApplicationUserManager .”
这是没有实例化的服务:
public class EmployeeService : Service<Employee>, IEmployeeService
{
private readonly ApplicationUserManager _userManager;
public EmployeeService(IUnitOfWork uow, ApplicationUserManager use
如何从源代码构建Autofac?我发现只有一个不推荐使用的维基页面。
我尝试启动go.cmd (.NET Framework4.0),但失败了,出现错误:
C:\Autofac\Autofac.csproj" (default target) (4) ->
(CoreCompile target) ->
Builder\MetadataConfiguration.cs(28,14): error CS0234: The type or namespace name 'Linq' does not exist in the namesp
我想将这些依赖项注入与autofac 进行比较。
对此:
但我在运行程序中遇到了错误:
An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = PolicyEvaluator (ReflectionActivator), Services = [Microsoft.AspNetCore.Authorization.Policy.IPolicyEvaluator], Lifetime =