Self referencing loop detected – Getting back data from WebApi to the browser

Is this because the Question has Answers and the Answers have a reference back to Question? Yes. It cannot be serialized. EDIT: See Tallmaris’s answer and OttO’s comment as it is simpler and can be set globally. GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Re‌​ferenceLoopHandling = ReferenceLoopHandling.Ignore; Old Answer: Project the EF object Question to your own intermediate or DataTransferObject. This Dto … Read more

Custom Authorization in Asp.net WebApi – what a mess?

Which methods should I use : IsAuthorized or OnAuthorization ? ( or when to use which) You will extend AuthorizationFilterAttribute if your authorization logic is not dependent on the identity established and roles. For user related authorization, you will extend and use AuthorizeAttribute. For the former case, you will override OnAuthorization. For the latter case, … Read more

ServiceStack vs ASP.Net Web API [closed]

They have very similar use-cases, as the lead maintainer for the ServiceStack project I have a good insight into ServiceStack’s advantages and the many natural benefits of its message-based design. ServiceStack has been around since 2008 as an OSS-run project from its inception with a single goal of promoting the correct design and implementation of … Read more

NetworkSecurityConfig: No Network Security Config specified, using platform default Error response code: 400

Try these solutions Solution 1) Add the following attribute to the <application tag in AndroidManifest.xml: android:usesCleartextTraffic=”true” Solution 2) Add android:networkSecurityConfig=”@xml/network_security_config” to the <application tag in app/src/main/AndroidManifest.xml: <application android:name=”.ApplicationClass” android:allowBackup=”true” android:hardwareAccelerated=”false” android:icon=”@mipmap/ic_launcher” android:label=”@string/app_name” android:largeHeap=”true” android:networkSecurityConfig=”@xml/network_security_config” android:supportsRtl=”true” android:theme=”@style/AppTheme”> With a corresponding network_security_config.xml in app/src/main/res/xml/: <?xml version=”1.0″ encoding=”utf-8″?> <network-security-config> <base-config cleartextTrafficPermitted=”true” /> </network-security-config> Refer this answer for more … Read more

ASP.NET Web API returns 404 for PUT only on some servers

For those of you who do not have WebDAV enabled but are still running into this issue using MVC 4’s Web API’s… Steve Michelotti documented a solution that worked for me here. At the end of the day, I enabled all verbs (verb=”*”) to the ExtensionlessUrlHandler-Integrated-4.0 handler in my web config. <system.webServer> <validation validateIntegratedModeConfiguration=”false” /> … Read more

ASP.NET Core API only returning first result of list

Add this to Startup.cs inside the public void ConfigureServices(IServiceCollection services) method: services.AddMvc().AddJsonOptions(options => { options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; }); The issue was discussed https://github.com/aspnet/Mvc/issues/4160 and https://github.com/aspnet/EntityFramework/issues/4646 also see circular reference