
-
Under the file of <code>XXXContext.cs</code>, and In the region of <code>Database Context</code>, append this code inside of <code>XXXContext()</code> constructor method:
<code>base.Configuration.ProxyCreationEnabled = false;</code> -
Or you can Insert the following codes inside of <code>Global.asax file</code>
<code>
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
</code>
网友评论