0

I'm trying to add a custom action method to customize the SXA-Storefront.

I'm using the CheckoutController of the Sitecore.Commerce.XA.Feature.Cart while I make an ajax call to my custom Controller action method(VerifyAddress), I get the following error:

    [FileLoadException]: Could not load file or assembly 
    'Microsoft.Extensions.DependencyInjection, Version=3.0.0.0, 
    Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its 
    dependencies. The located assembly's manifest definition does not match 
    the assembly reference. (Exception from HRESULT: 0x80131040)
    at Sitecore.Commerce.XA.Feature.Cart.Controllers.CheckoutController.VerifyAddress(Address shippingAddress)
    at lambda_method(Closure , ControllerBase , Object[] )
    at 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext 
    controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 
    parameters)
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.c. 
    b__9_0(IAsyncResult asyncResult, 
    ActionInvocation innerInvokeState)
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__11_0()
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.c__DisplayClass11_1.b__2()
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.c__DisplayClass11_1.b__2()
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass3_6.b__3()
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass3_1.b__5(IAsyncResult asyncResult)
    [HttpUnhandledException]: An unhandled exception occurred.
     at Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage.ShowErrorMessage(ExceptionContext exceptionContext, ExceptionArgs args)
     at Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage.Process(ExceptionArgs args)
     at (Object , Object )
     at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
     at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
     at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
     at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
     at Sitecore.Mvc.Filters.PipelineBasedRequestFilter.OnException(ExceptionContext exceptionContext)
     at System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception)
     at System.Web.Mvc.Async.AsyncControllerActionInvoker.c__DisplayClass3_1.b__5(IAsyncResult asyncResult)
     at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
     at System.Web.Mvc.Controller.c.b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState)
     at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
     at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
     at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
     at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
     at System.Web.Mvc.MvcHandler.c.b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState)
     at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
     at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
     at Sitecore.Mvc.Routing.RouteHttpHandler.EndProcessRequest(IAsyncResult result)
     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
     at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

This is my code for ajax call :

 $.ajax({
                url: '@Url.Action("VerifyAddress","Checkout")',
                type: "POST",
                data: JSON.stringify(shippingAddress),
                contentType: 'application/json',
                async: false,
                success: function (result, status, xhr) {
                    alert("success");

                },
                error: function (xhr, status, error) {
                    alert("error");
                    console.log(xhr.responseText);
                }

            });
  • Which XC version? – Andrei Paliakou Nov 14 at 13:45
  • Looks like you use incorrect Microsoft.Extensions.DependencyInjection.dll version. – Andrei Paliakou Nov 14 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.