Skip to content

Instantly share code, notes, and snippets.

@rmueller
Created September 9, 2015 18:52
Show Gist options
  • Save rmueller/aec0aef4150c8c1a1f8d to your computer and use it in GitHub Desktop.
Save rmueller/aec0aef4150c8c1a1f8d to your computer and use it in GitHub Desktop.
class Program
{
static void Main(string[] args)
{
System.Net.ServicePointManager.DefaultConnectionLimit = Int32.MaxValue;
string baseAddress = "http://localhost:3333/";
// Start OWIN host
using (WebApp.Start<Startup>(url: baseAddress))
{
Console.ReadLine();
}
}
}
public class Startup
{
public void Configuration(IAppBuilder appBuilder)
{
var config = new HttpConfiguration();
//config.
//add routes, configure Web API
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
appBuilder.UseWebApi(config);
}
}
public class TesteController : ApiController
{
[HttpPost]
public HttpResponseMessage RecepcionarNotaSincrona()
{
var c = Request.Content.ReadAsStringAsync().Result;
Thread.Sleep(6000);
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(c, Encoding.UTF8, "text/plain")
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment