作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试在我的项目中调用 Controller 时收到以下错误,该 Controller 使用 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 constructor.",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": " at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()",
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "An exception was thrown while activating Chatech.Quartz.Owin.Controllers.QuartzController -> Chatech.Quartz.Owin.Application.JobInformation.JobInformationService -> λ:Quartz.IScheduler.",
"ExceptionType": "Autofac.Core.DependencyResolutionException",
"StackTrace": " at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters, Object& decoratorTarget) in C:\\projects\\autofac\\src\\Autofac\\Core\\Resolving\\InstanceLookup.cs:line 135\r\n at Autofac.Core.Resolving.InstanceLookup.Execute() in C:\\projects\\autofac\\src\\Autofac\\Core\\Resolving\\InstanceLookup.cs:line 83\r\n at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in C:\\projects\\autofac\\src\\Autofac\\Core\\Resolving\\ResolveOperation.cs:line 131\r\n at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in C:\\projects\\autofac\\src\\Autofac\\Core\\Resolving\\ResolveOperation.cs:line 93\r\n at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) in C:\\projects\\autofac\\src\\Autofac\\ResolutionExtensions.cs:line 1041\r\n at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters) in C:\\projects\\autofac\\src\\Autofac\\ResolutionExtensions.cs:line 814\r\n at Autofac.Integration.WebApi.AutofacWebApiDependencyScope.GetService(Type serviceType)\r\n at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1& activator)\r\n at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)",
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "Object serializer type 'Quartz.Simpl.JsonObjectSerializer, Quartz.Serialization.Json' could not be instantiated.",
"ExceptionType": "Quartz.SchedulerException",
"StackTrace": " at Quartz.Impl.StdSchedulerFactory.<Instantiate>d__65.MoveNext() in C:\\projects\\quartznet\\src\\Quartz\\Impl\\StdSchedulerFactory.cs:line 666\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Quartz.Impl.StdSchedulerFactory.<GetScheduler>d__69.MoveNext() in C:\\projects\\quartznet\\src\\Quartz\\Impl\\StdSchedulerFactory.cs:line 1114\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Autofac.Extras.Quartz.QuartzAutofacFactoryModule.<>c.<Load>b__8_2(IComponentContext c) in C:\\work\\autofac.extras.quartz\\src\\Autofac.Extras.Quartz\\QuartzAutofacFactoryModule.cs:line 90\r\n at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass0_0`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) in C:\\projects\\autofac\\src\\Autofac\\Builder\\RegistrationBuilder.cs:line 62\r\n at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in C:\\projects\\autofac\\src\\Autofac\\Core\\Activators\\Delegate\\DelegateActivator.cs:line 72\r\n at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters, Object& decoratorTarget) in C:\\projects\\autofac\\src\\Autofac\\Core\\Resolving\\InstanceLookup.cs:line 117",
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "Could not load type 'Quartz.Simpl.JsonObjectSerializer, Quartz.Serialization.Json'",
"ExceptionType": "System.TypeLoadException",
"StackTrace": " at Quartz.Simpl.SimpleTypeLoadHelper.LoadType(String name) in C:\\projects\\quartznet\\src\\Quartz\\Simpl\\SimpleTypeLoadHelper.cs:line 58\r\n at Quartz.Impl.StdSchedulerFactory.<Instantiate>d__65.MoveNext() in C:\\projects\\quartznet\\src\\Quartz\\Impl\\StdSchedulerFactory.cs:line 653"
}
}
}
}
我有以下初始化 Quartz.Net 的代码
var schedulerConfig = new NameValueCollection
{
{"quartz.serializer.type", "json"},
{"quartz.scheduler.instanceName", "Main Quartz Job Scheduler"},
{"quartz.scheduler.instanceId", "QuartzAdmin"},
};
containerBuilder.RegisterModule(new QuartzAutofacFactoryModule
{
ConfigurationProvider = c => schedulerConfig
});
如果我评论 {"quartz.serializer.type", "json"},
一切正常。我已经引用了 Quartz.Serialization.Json
并且我看到它正在被复制到 bin\Debug 文件夹中。这里有什么问题?
最佳答案
有一个单独的Quartz.Serialization.Json您需要安装以使用 json
序列化程序的包。
关于c# - 尝试将 Quartz.NET 与 oWin 一起使用时出现 Quartz.Simpl.JsonObjectSerializer 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58777213/
当我尝试在我的项目中调用 Controller 时收到以下错误,该 Controller 使用 oWin 和 Quartz.Net 3.0.7 和 Autofac。 { "Message": "An
我是一名优秀的程序员,十分优秀!