dotnetnuke - 使用 WebAPI 时具有 2sxc 的 DNN 引发 500 错误
问题描述
我首先尝试制作自己的 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 错误之后删除太多了。
解决方案
推荐阅读
- angular - 增加垫表角度中垫子行之间的间隙
- data-science - 使用 ARIMA 进行多特征预测
- javascript - 发生未处理的异常:在 Angular 9 的构建产品上超出了调用重试次数
- c - remove() 返回文件未找到错误(errno = 2),当我之前使用相同的文件字符串打开文件时
- amazon-web-services - AWS ECS 部署:内存不足
- .net - ORA-08103: .net 中不再存在对象
- swift - CIstraightenFilter 为大输入返回空白图像
- java - 如何下载“com.dalsemi.onewire”包?
- spring-boot - 如何在 Spring Boot 中将带有斜杠的参数传递到存储库
- excel - 从另一个工作簿填充组合框