"Message" : "there is an error,,"
"ExceptionMessage" : "trying to create" ProductController "type of error controller, please make sure that the controller has a parameterless public constructor,",
"ExceptionType" : "System. InvalidOperationException,"
"StackTrace" : "in the System. Web. Http. Dispatcher. DefaultHttpControllerActivator. Create (HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) \ r \ n in the System. Web. Http. Controllers. HttpControllerDescriptor. CreateController (HttpRequestMessage request) \ r \ n in the System. Web. Http. Dispatcher. HttpControllerDispatcher. & lt; SendAsync> D__15. MoveNext (), "
"InnerException" : {
"Message" : "there is an error,,"
"ExceptionMessage" : "An error occurred during the activation of a particular registration. See the inner exception for details. Registration: the Activator=ProductController (ReflectionActivator), Services=[TSC. WebApiX. Controllers. ProductController], Lifetime=Autofac. Core. Lifetime. CurrentScopeLifetime, Sharing=None, Ownership=OwnedByLifetimeScope - & gt; None of the constructors found with 'Autofac. Core. Activators. Reflection. DefaultConstructorFinder' on type 'TSC. WebApiX. Controllers. The ProductController' can be invoked with the available services and parameters: \ r \ nCannot resolve parameter 'TSC. Service. ProductService ProductService' of constructor 'Void. Ctor (TSC) Service) ProductService)'. (See inner exception for details.), "
"ExceptionType" : "Autofac. Core. DependencyResolutionException",
"StackTrace": " 在 Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)\r\n 在 Autofac.Core.Resolving.InstanceLookup.Execute()\r\n 在 Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)\r\n 在 Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)\r\n 在 Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)\r\n 在 Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)\r\n 在 Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)\r\n 在 Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType)\r\n 在 Autofac.Integration.WebApi.AutofacWebApiDependencyScope.GetService(Type serviceType) 位置 C:\\projects\\autofac-webapi\\src\\Autofac.Integration.WebApi\\AutofacWebApiDependencyScope.cs:行号 76\r\n 在 System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1& The activator) \ r \ n in the System. Web. Http. Dispatcher. DefaultHttpControllerActivator. Create (HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType). "
"InnerException" : {
"Message" : "there is an error,,"
"ExceptionMessage" : "None of the constructors found with 'Autofac. Core. Activators. Reflection. DefaultConstructorFinder' on type 'TSC. WebApiX. Controllers. The ProductController' can be invoked with the available services and parameters: \ r \ nCannot resolve parameter 'TSC. Service. ProductService ProductService' of constructor 'Void. Ctor (TSC) Service) ProductService)'.",
"ExceptionType" : "Autofac. Core. DependencyResolutionException",
"StackTrace" : "in the Autofac. Core. Activators. Reflection. ReflectionActivator. GetValidConstructorBindings (IComponentContext context, IEnumerable ` 1 parameters) \ r \ n the Autofac. Core. The Activators. Reflection. ReflectionActivator. ActivateInstance (IComponentContext context, IEnumerable ` 1 parameters) \ r \ n the Autofac. Core. Resolving. InstanceLookup. Activate (IEnumerable ` 1 parameters)"
}
}
}
Is the problem that the dependency injection? Specific what's the problem?
CodePudding user response:
General class will give you to create a structure, and must be in this thing, but, when you manually create a reference structure, class will not automatically created for you, you can manually create, public product.. () {}CodePudding user response:
The controller to add refer to the service