39 строки
1.2 KiB
C#
39 строки
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Http;
|
|
using Owin;
|
|
|
|
namespace Microsoft.Hpc.Communicators.LinuxCommunicator
|
|
{
|
|
public class Startup
|
|
{
|
|
public void Configuration(IAppBuilder appBuilder)
|
|
{
|
|
var config = new HttpConfiguration();
|
|
|
|
// Web API configuration and services
|
|
|
|
// Web API routes
|
|
config.MapHttpAttributeRoutes();
|
|
|
|
config.Routes.MapHttpRoute(
|
|
name: "DefaultApi",
|
|
routeTemplate: "api/{controller}/{id}",
|
|
defaults: new { id = RouteParameter.Optional }
|
|
);
|
|
|
|
config.MessageHandlers.Add(new MessageAuthenticationHandler());
|
|
|
|
var json = config.Formatters.JsonFormatter;
|
|
json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
|
|
config.Formatters.Remove(config.Formatters.XmlFormatter);
|
|
json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None;
|
|
|
|
appBuilder.UseWebApi(config);
|
|
}
|
|
}
|
|
}
|