Sitecore XConnect:尝试创建“ContactsController”类型的控制器时发生错误

时间:2018-01-17 13:21:27

标签: dependency-injection sitecore

我在Sitecore 9中调用xConnect客户端时遇到问题,更新1。 客户端对象的启动运行正常。 但是当我在客户端上调用一个方法时,我得到了这个例外:


{
    "Message":"An error has occurred.",
    "ExceptionMessage":"An error occurred when trying to create a controller of type 'ContactsController'. 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)
   at Sitecore.XConnect.Web.DependencyInjection.WebApiServiceControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)
   at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()",
    "InnerException":{
        "Message":"An error has occurred.",
        "ExceptionMessage":"Type 'Sitecore.XConnect.Web.Controllers.ContactsController' does not have a default constructor",
        "ExceptionType":"System.ArgumentException",
        "StackTrace":"   at System.Linq.Expressions.Expression.New(Type type)
       at System.Web.Http.Internal.TypeActivator.Create[TBase](Type instanceType)
       at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1& activator)
       at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)"}}

1 个答案:

答案 0 :(得分:0)

  1. 检查证书是否具有MMC中xconnect应用程序池的托管私钥
  2. 如果第一点现在不起作用,请尝试使用power shell命令:

Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$_.Issuer -ne $_.Subject} | Move-Item -Destination Cert:\LocalMachine\CA

  1. 如果第二点不起作用,请检查以下两个服务是否正在运行: enter image description here