DNN с 2sxc выбрасывает 500 ошибка при использовании WebAPI - PullRequest
0 голосов
/ 11 февраля 2019

Сначала я попытался создать свой собственный модуль WebAPI, но получал постоянные 500 ошибок с сообщением:

Message: An error has occured
Detail: An error occurred when trying to create a controller of type 'CareerRequestController'. Make sure that the controller has a parameterless public constructor.

После того, как я в конце концов сдался, я скачал демо с 2sxc (https://2sxc.org/en/apps/app/tutorial-webapi-basic-app-for-dnn-dotnetnuke)

После установки и пробных ссылок меня встретила та же ошибка (за исключением SimpleDemoRequestsController вместо CareerRequestController.

Просто интересно, что пошло не так, если демо-приложение не работает.

ПолнаяОшибка:

"{"Message":"An error has occurred.","ExceptionMessage":"An error occurred when trying to create a controller of type 'SimpleDemoRequestsController'. 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.Tracing.Tracers.HttpControllerActivatorTracer.<>c__DisplayClass2.<System.Web.Http.Dispatcher.IHttpControllerActivator.Create>b__0()\r\n   at System.Web.Http.Tracing.ITraceWriterExtensions.TraceBeginEnd(ITraceWriter traceWriter, HttpRequestMessage request, String category, TraceLevel level, String operatorName, String operationName, Action`1 beginTrace, Action execute, Action`1 endTrace, Action`1 errorTrace)\r\n   at System.Web.Http.Tracing.Tracers.HttpControllerActivatorTracer.System.Web.Http.Dispatcher.IHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)\r\n   at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)\r\n   at System.Web.Http.Tracing.Tracers.HttpControllerDescriptorTracer.<>c__DisplayClass2.<CreateController>b__0()\r\n   at System.Web.Http.Tracing.ITraceWriterExtensions.TraceBeginEnd(ITraceWriter traceWriter, HttpRequestMessage request, String category, TraceLevel level, String operatorName, String operationName, Action`1 beginTrace, Action execute, Action`1 endTrace, Action`1 errorTrace)\r\n   at System.Web.Http.Tracing.Tracers.HttpControllerDescriptorTracer.CreateController(HttpRequestMessage request)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()","InnerException":{"Message":"An error has occurred.","ExceptionMessage":"Unable to resolve SimpleDemoRequestsController.\r\nWhere no service registrations found\r\n  and number of Rules.FallbackContainers: 1\r\n  and number of Rules.UnknownServiceResolvers: 0","ExceptionType":"DnnSharp.DryIoc.ContainerException","StackTrace":"   at DnnSharp.DryIoc.Throw.It(Int32 error, Object arg0, Object arg1, Object arg2, Object arg3)\r\n   at DnnSharp.DryIoc.Container.ThrowUnableToResolve(Request request)\r\n   at DnnSharp.DryIoc.Container.DnnSharp.DryIoc.IContainer.ResolveFactory(Request request)\r\n   at DnnSharp.DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault)\r\n   at DnnSharp.DryIoc.Container.DnnSharp.DryIoc.IResolver.Resolve(Type serviceType, Boolean ifUnresolvedReturnDefault)\r\n   at DnnSharp.DryIoc.WebApi.DryIocDependencyScope.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)"}}"

Другие примечания:

2sxc Версия: 9.33.0

DotNetNuke Версия: 9.2.2

Я переустановил 2sxcприложение дважды, в первый раз это было удаление до того, как я обновил его, затем удаление после этой ошибки 500 становилось слишком много.

...