Skip to content

Instantly share code, notes, and snippets.

@serefarikan
Forked from andrewabest/Startup.cs
Created March 20, 2020 12:30
Show Gist options
  • Save serefarikan/2d3a4fb915b527c84cb0b0f5a03899b2 to your computer and use it in GitHub Desktop.
Save serefarikan/2d3a4fb915b527c84cb0b0f5a03899b2 to your computer and use it in GitHub Desktop.
Packages and Startup for WebAPI 2.2 on Owin + IIS hosting
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net461" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net461" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net461" />
<package id="Owin" version="1.0" targetFramework="net461" />
</packages>
[assembly: OwinStartup(typeof(Startup))]
namespace Api
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
config.Formatters.Remove(config.Formatters.XmlFormatter);
config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
app.UseWebApi(config);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment