Skip to content

Instantly share code, notes, and snippets.

Last active June 2, 2023 00:45
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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