Recent

Author Topic: Web Application Not Running  (Read 1609 times)

jshah

  • Full Member
  • ***
  • Posts: 128
Web Application Not Running
« on: February 26, 2018, 03:20:08 pm »
used : weblaz/HTTP Server Application project type
Error Message : Missing HTTP protocol version in request when open the http://localhost:9250

Code: Pascal  [Select]
  1.  
  2. program httpproject1;
  3.  
  4. {$mode objfpc}{$H+}
  5.  
  6. uses
  7.   cthreads, fphttpapp, Unit1;
  8.  
  9. begin
  10.   Application.Title:='httpproject1';
  11.   Application.Port:=9250;
  12.   Application.Threaded:=True;
  13.   Application.Initialize;
  14.   Application.Run;
  15. end.    
  16.  
  17. unit Unit1;
  18.  
  19. {$mode objfpc}{$H+}
  20.  
  21. interface
  22.  
  23. uses
  24.     SysUtils, Classes, httpdefs, fpHTTP, fpWeb, fpwebdata;
  25.  
  26. type
  27.     { TFPWebModule1 }
  28.     TFPWebModule1 = class(TFPWebModule)
  29.         procedure DataModuleCreate(Sender : TObject);
  30.         procedure DataModuleRequest(Sender : TObject; ARequest : TRequest;
  31.             AResponse : TResponse; Var Handled : Boolean);
  32.     private
  33.  
  34.     public
  35.  
  36.     end;
  37.  
  38. var
  39.     FPWebModule1 : TFPWebModule1;
  40.  
  41. implementation
  42.  
  43. {$R *.lfm}
  44.  
  45. { TFPWebModule1 }
  46.  
  47. procedure TFPWebModule1.DataModuleCreate(Sender : TObject);
  48. begin
  49.  
  50. end;
  51.  
  52. procedure TFPWebModule1.DataModuleRequest(Sender : TObject;
  53.     ARequest : TRequest; AResponse : TResponse; Var Handled : Boolean);
  54. begin
  55.     AResponse.ContentType := 'text/html;charset=utf-8';
  56.     AResponse.Content     := '<html>Hello, World!</html>';
  57.     Handled := true ;
  58. end;
  59.  
  60. initialization
  61.     RegisterHTTPModule('TFPWebModule1', TFPWebModule1);
  62. end.
  63.  
  64.  

nummer8

  • New member
  • *
  • Posts: 46
Re: Web Application Not Running
« Reply #1 on: February 26, 2018, 03:21:26 pm »
Application.Legacyrouting := True;


jshah

  • Full Member
  • ***
  • Posts: 128
Re: Web Application Not Running
« Reply #2 on: February 26, 2018, 03:33:44 pm »
Now Error :
EResnotfound

Error Message:
Resource TCustomHTTPModule not found


jshah

  • Full Member
  • ***
  • Posts: 128
Re: Web Application Not Running
« Reply #3 on: February 26, 2018, 03:51:20 pm »
click on continue / break in error message dialog it showing hello world  in browser

Leledumbo

  • Hero Member
  • *****
  • Posts: 7983
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Web Application Not Running
« Reply #4 on: February 26, 2018, 07:35:01 pm »
click on continue / break in error message dialog it showing hello world  in browser
Yes, there are intentional exception inside the framework code that GDB will catch despite it's has actually been handled internally. I suggest ignoring this one (and some several others, basically anything that doesn't come from your own code).

jshah

  • Full Member
  • ***
  • Posts: 128
Re: Web Application Not Running
« Reply #5 on: February 26, 2018, 11:17:09 pm »
Ok Thanks