Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tobbe 81 posts 387 karma points c-trib
    Oct 17, 2016 @ 07:18
    Tobbe
    0

    A null 'MediaTypeFormatter' is not valid. Parameter name: formatters

    Im getting this error (500) randomly (1 of 10 times) when trying to access my UmbracoApiControllers.

    Im running the latest umbraco (7.5.3).

    Any ideas what could cause this?

    exceptionMessage
    :
    "A null 'MediaTypeFormatter' is not valid.
    ↵Parameternamn: formatters"
    exceptionType
    :
    "System.ArgumentException"
    message
    :
    "An error has occurred."
    stackTrace
    :
    "   vid System.Net.Http.Formatting.MediaTypeFormatterCollection.VerifyAndSetFormatters(IEnumerable`1 formatters)
    ↵   vid System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)
    ↵   vid System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)
    ↵   vid System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)
    ↵   vid System.Web.Http.ModelBinding.FormatterParameterBinding.<ExecuteBindingAsyncCore>d__0.MoveNext()
    ↵--- Slut på stackspårningen från föregående plats där ett undantag utlöstes ---
    ↵   vid System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    ↵   vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    ↵   vid System.Web.Http.Controllers.HttpActionBinding.<ExecuteBindingAsyncCore>d__0.MoveNext()
    ↵--- Slut på stackspårningen från föregående plats där ett undantag utlöstes ---
    ↵   vid System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    ↵   vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    ↵   vid System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
    ↵--- Slut på stackspårningen från föregående plats där ett undantag utlöstes ---
    ↵   vid System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    ↵   vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    ↵   vid System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
    

    Here's one of my controllers:

    [HttpPost]
    public HttpResponseMessage Sync(SyncObj sync)
    {
        return GetUserProjects(user.Id);
    }
    
    public class SyncProject
        {
            public Guid Id { get; set; }
            public DateTime LastSync { get; set; }
            public DateTime EditedAt { get; set; }
            public int UserId { get; set; }
            public List<SyncPlate> Plates { get; set; }
            public bool Bits { get; set; }
            public bool Cableties { get; set; }
            public string Name { get; set; }
            public bool Screws { get; set; }
        }
    
        public class SyncPlate
        {
            public Guid Id { get; set; }
            public Guid ProjectId { get; set; }
            public DateTime LastSync { get; set; }
            public DateTime EditedAt { get; set; }
            public bool IsNew { get; set; }
            public string TextRowsJson { get; set; }
            public int UserId { get; internal set; }
        }
    
        public class SyncObj
        {
            public List<SyncProject> Projects { get; set; }        
            public List<SyncPlate> PlatesToRemove { get; set; }
            public List<Guid> ProjectIdsToRemove { get; set; }
        }
    
  • Tobbe 81 posts 387 karma points c-trib
    Oct 17, 2016 @ 09:21
    Tobbe
    100

    I THINK the problem was that I made 2 requests to the api at almost the same time.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies