Forum > Windows
[SOLVED] Compiled indy laz web server on win 7, cannot serve on win 10
Mongkey:
My server running well on win7, but do nothing on win 10? Any other had same issue? Thank you
Brook also do nothing on win 10, if i compiled the server on win 7.
No SSL, just simple http server.
Effort:
-setting firewall done
No result .
Does it need to be built on same environment to run?
nummer8:
Hi,
I tested the code below from medium.com written by Marcus Fernström on windows 10
without any issues.
Link to original code:
https://medium.com/@marcusfernstrm/create-rest-apis-with-freepascal-441e4aa447b7
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program RestApi;{$mode objfpc}{$H+}uses {$IFDEF UNIX}cthreads, cmem,{$ENDIF} SysUtils, fphttpapp, httpdefs, httproute, fpjson, jsonparser; procedure jsonResponse(var res: TResponse; data: String);begin res.Content := data; res.Code := 200; res.ContentType := 'application/json'; res.ContentLength := length(res.Content); res.SendContent;end; procedure timeEndpoint(req: TRequest; res: TResponse);var jObject : TJSONObject;begin jObject := TJSONObject.Create; try jObject.Strings['time'] := TimeToStr(Time); jsonResponse(res, jObject.AsJSON); finally jObject.Free; end;end; procedure greetingEndpoint(req: TRequest; res: TResponse);var jObject : TJSONObject;begin jObject := TJSONObject.Create; try jObject.Strings['greeting'] := 'Hello, ' + req.RouteParams['name']; jsonResponse(res, jObject.AsJSON); finally jObject.Free; end;end; begin Application.Port := 9080; HTTPRouter.RegisterRoute('/time', @timeEndpoint, true); HTTPRouter.RegisterRoute('/greeting/:name', @greetingEndpoint); Application.Threaded := true; Application.Initialize; Application.Run;
paweld:
I haven't encountered any problems with a indy http server, I tested on windows 7/10/server 2008/2012/2016/2019
nummer8:
Reading properly is very difficult. :-[
I also tested the INDY http server on windows 10.
No problems.
Mongkey:
Hi, thank you all for your quick replies, i mean compiled on win 7 , then run your exe on win 10 guys ::), i did a lot server programming by the way :D
Navigation
[0] Message Index
[#] Next page