Test1.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Web;
  3. using System.Web.Hosting;
  4. using System.Web.Configuration;
  5. namespace TestMonoWeb
  6. {
  7. public class MyHost : MarshalByRefObject {
  8. public MyHost() {
  9. }
  10. }
  11. /// <summary>
  12. /// Summary description for Test1.
  13. /// </summary>
  14. public class Test1
  15. {
  16. static void Main(string[] args) {
  17. // Create the application host
  18. object host = ApplicationHost.CreateApplicationHost(typeof(MyHost), "/", "c:\\");
  19. int request_count = 10;
  20. SimpleWorkerRequest [] requests = new SimpleWorkerRequest[request_count];
  21. int pos;
  22. for (pos = 0; pos != request_count; pos++) {
  23. requests[pos] = new SimpleWorkerRequest("test.aspx", "", Console.Out);
  24. }
  25. ModulesConfiguration.Add("syncmodule", typeof(SyncModule).AssemblyQualifiedName);
  26. ModulesConfiguration.Add("asyncmodule", typeof(AsyncModule).AssemblyQualifiedName);
  27. HandlerFactoryConfiguration.Add("get", "/", typeof(AsyncHandler).AssemblyQualifiedName);
  28. //HandlerFactoryConfiguration.Add("get", "/", typeof(SyncHandler).AssemblyQualifiedName);
  29. for (pos = 0; pos != request_count; pos++)
  30. HttpRuntime.ProcessRequest(requests[pos]);
  31. HttpRuntime.Close();
  32. /*
  33. Console.Write("Press Enter to quit.");
  34. Console.WriteLine();
  35. Console.ReadLine();
  36. */
  37. }
  38. }
  39. }