【问题标题】:Access localhost via internet通过互联网访问本地主机
【发布时间】:2017-11-22 16:29:07
【问题描述】:

我通过 IdHTTP 组件创建了一个HTTP server,现在我想通过互联网访问它。我已经从一个文本文件中发布了一个字符串。

我可以通过以下方式访问它:

http://localhost

但是我如何通过互联网访问它?我试过http://[myexternalIPaddress]:80,但没有得到回复。

这是我的代码:

procedure TForm1.IdHTTPServer1CommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
  myFile : TextFile;
  text: String;
begin
  AssignFile(myFile, 'C:\Users\xxx\Desktop\test.txt');
  Reset(myFile);
  ReadLn(myFile, text);  
  AResponseInfo.ContentText := text;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  IdHTTPServer1.Active := True;
end;

【问题讨论】:

  • 您需要端口转发您的路由器。在路由器中打开端口 80(并允许防火墙中的连接)

标签: delphi-7 indy10 idhttp


【解决方案1】:

您需要配置您的 Windows 防火墙(如果启用)以允许到端口 80 的入站连接,并且您还需要配置您的网络路由器(如果有)将入站连接转发到路由器公共 IP 上的端口 80 到服务器计算机上的端口 80。

【讨论】:

    猜你喜欢
    • 2015-02-12
    • 2017-03-04
    • 2018-10-10
    • 2011-01-12
    • 2023-03-29
    • 2011-06-02
    • 2016-10-17
    • 2021-11-14
    • 2012-09-26
    相关资源
    最近更新 更多