Skip to content

Instantly share code, notes, and snippets.

Last active June 2, 2023 00:45
Show Gist options
  • Save doggy8088/5566036 to your computer and use it in GitHub Desktop.
Save doggy8088/5566036 to your computer and use it in GitHub Desktop.
ReferenceLoopHandling for ASP.NET Web API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace WebApiSample
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit
public class WebApiApplication : System.Web.HttpApplication
protected void Application_Start()
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
Copy link

Whenever I add this to my code, it results in 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt'
Any idea what is wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment