Created
September 9, 2015 18:52
-
-
Save rmueller/aec0aef4150c8c1a1f8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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