卷曲 URL 无法连接的问题
所以我不是一个很好的网络人,所以我希望有人能给我指出正确的方向,以找出我做错了什么。
我正在尝试使用curl 来发布SOAP 消息。我正在运行以下命令:
curl -d "string of xml message" -H "Content-Type:text/xml; charset=utf-8" "[ip]:[port]/[service]"
这会导致 '连接被拒绝”消息。
所以我尝试自行 ping ip...没有问题。 然后我想也许我需要 http://[ip]:[port]/[service]< /a> 所以我尝试 ping http://[ip] ,我得到: 未知主机 http://[ip] 但如果我单独 ping IP,则不会出现任何问题。
关于从哪里开始调试这个问题有什么想法吗?
So I'm not a very good network person so I was hoping someone could point me in the right direction to figuring out what I am doing wrong.
I am trying to use curl to post a SOAP message. I am running the following:
curl -d "string of xml message" -H "Content-Type:text/xml; charset=utf-8" "[ip]:[port]/[service]"
This results in a 'Connection refused' message.
So I try pinging ip by itself...no problems.
Then I think maybe I need http://[ip]:[port]/[service] so I tried pinging http://[ip] and I get:
unknown host http://[ip] yet if I ping the IP by itself I get no issues.
Any thoughts on where to start debugging this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,ping不能使用HTTP协议,只能ping域名。请查看ping 维基百科以了解更多信息。
Curl 通常不需要任何花哨的东西,只需输入
curl [protocol]:[host]:[port]/[service]
开始,看看是否得到响应。我认为这就是您尝试 ping 远程地址时所寻找的内容。根据 cURL 尝试的响应来判断,您将知道您的尝试是否成功。可能不会,因为它确实是被拒绝的连接,您没有包含错误的参数。
现在,假设这是一个连接问题,请尝试卷曲其他内容(常规域,例如 Google.com)以确保没有连接问题。然后,要了解远程服务器是否有问题,请从某处的另一台服务器执行相同的 Curl 尝试(或要求其他人执行此操作),并查看它们是否也被拒绝连接。这是围绕问题并获得更清晰的一个很好的尝试。
First of all, ping can't use the HTTP-protocol, you can only ping domain names. Have a look at ping at wikipedia to learn more.
Curl normally doesn't need anything fancy, just begin by typing
curl [protocol]:[host]:[port]/[service]
and see if you get a response at all. I think that's what you're looking for when you tried to ping the remote address.Judging by the response of the cURL attempt, you'll know if your attempt was successfull. It probably won't be since it is indeed the connection that was refused, you didn't include bad parameters.
Now, assuming it's a connection problem, try curling something else (a regular domain, like Google.com) to make sure you don't have a connection problem. Then, to learn whether the remote server has a problem, perform the same Curl attempt from another server somewhere (or ask someone else to do it) and see if they, too, are refused to connect. This is a good attempt to circle in around the problem and gain more clarity.
Ping(或 ICMP)流量(通常)在与 HTTP 流量不同的端口上运行。 HTTP 通常在端口 80 上运行。
尝试使用以下命令远程登录到服务(IP 和端口):
telnet (ip) 80(不带括号)。
如果您能够连接到该服务,那么您还会遇到一些其他问题,但是,如果该服务不允许您连接,那么您就知道该服务正在阻止您访问该服务所在的端口(通常为 http 的 80)跑步。
Ping (or ICMP) traffic runs (usually) on a different port than HTTP traffic. HTTP typically runs on port 80.
Try to telnet to the service (the ip and the port) using the following command:
telnet (ip) 80 (without the parens).
If you are able to connect to the service then you have some other issues, however, if the service doesn't let you connect, then you know the service is blocking you from the port (usually 80 for http) on which the service is running.