Program.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Threading;
  3. using Microsoft.AspNetCore.Builder;
  4. using Microsoft.AspNetCore.Hosting;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.AspNetCore.Http.Features;
  7. using Microsoft.Extensions.Hosting;
  8. namespace PeachpieBenchmarks.Server
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. // Double ThreadPool for non-async calls
  15. ThreadPool.GetMinThreads(out int workerThread, out int completionThread);
  16. ThreadPool.SetMinThreads(workerThread * 2, completionThread);
  17. new WebHostBuilder()
  18. .UseKestrel()
  19. .UseUrls("http://*:8080/")
  20. .UseStartup<Startup>()
  21. .Build()
  22. .Run();
  23. }
  24. }
  25. class Startup
  26. {
  27. public void Configure(IApplicationBuilder app)
  28. {
  29. //// disable response buffering and chunked transfer
  30. //app.Use((httpcontext, next) =>
  31. //{
  32. // var responsefeature = httpcontext.Features.Get<IHttpResponseBodyFeature>();
  33. // responsefeature?.DisableBuffering();
  34. // //
  35. // return next();
  36. //});
  37. // app.UseResponseBuffering();
  38. app.UsePhp(new PhpRequestOptions(scriptAssemblyName: "Website"));
  39. // app.UseDefaultFiles();
  40. // app.UseStaticFiles();
  41. }
  42. }
  43. }