我首先尝试制作自己的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个错误后删除了。