简体   繁体   English

使用sim900发送get或post请求时Http错误码400

[英]Http error code 400 when using sim900 to send get or post requests


I have a SIM900 GSM module that I use to send GET and POST requests to servers. 我有一个 SIM900 GSM 模块,用于向服务器发送 GET 和 POST 请求。
Recently I rented a host for this purpose. 最近我为此租了一个主机。 I wrote a simple page using asp.net webforms to parse incoming data from the GSM module, everything was working until a few days ago I noticed that I no longer can receive data from my gsm module. 我使用 asp.net webforms 编写了一个简单的页面来解析来自 GSM 模块的传入数据,一切正常,直到几天前我注意到我无法再从我的 gsm 模块接收数据。
After investigating further I found out that the host I rented keeps returning HTTP 400 errors to my GSM module. 进一步调查后,我发现我租用的主机不断向我的 GSM 模块返回 HTTP 400 错误。 These responses are not from IIS but from Microsoft-HTTPAPI/2.0. 这些响应不是来自 IIS,而是来自 Microsoft-HTTPAPI/2.0。 The request header is this: 请求头是这样的:
 GET /test/data?meow HTTP/1.1 Host : www.whatever.com Connection : keep-alive

And this is the server response(body omitted):这是服务器响应(省略正文):

 HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Sun, 11 Oct 2020 12:08:28 GMT Connection: close Content-Length: 339

I used Postman (application) to simulate the same request and everything worked just fine.我使用 Postman(应用程序)来模拟相同的请求,一切正常。
I also made an exact copy of a chrome request header and gave it to the module, but that didn't work either.我还制作了 chrome 请求标头的精确副本并将其提供给模块,但这也不起作用。
Note: I am not using sim900's HTTP commands I am connecting to a certain port(80 in this case) and making a get request manually.注意:我没有使用 sim900 的 HTTP 命令,而是连接到某个端口(在本例中为 80)并手动发出获取请求。
Note 2:I have been given a Plesk panel to manage my website and do not have access to certain server settings.注 2:我已获得 Plesk 面板来管理我的网站,但无权访问某些服务器设置。

The request will pass through the http.sys module before entering iis, which will intercept requests that do not comply with the rules, so your response comes from Microsoft-HTTPAPI / 2.0 with a status code of 400. The solution to this can be to modify the registry, but the setting in the registry is based on your application and request, and there is no universal modification method.请求在进入iis之前会经过http.sys模块,它会拦截不符合规则的请求,所以你的响应来自Microsoft-HTTPAPI/2.0,状态码为400。 解决方法可以是修改注册表,但是注册表中的设置是根据你的应用和要求,没有通用的修改方法。

How to troubleshoot HTTP 400 errors 如何解决 HTTP 400 错误

Http.sys registry settings for Windows Windows 的 Http.sys 注册表设置

Another method is to suggest that you use a tool similar to Fiddler to capture the request sent by sim900 and the request sent by postman respectively.另一种方法是建议你使用类似Fiddler的工具分别抓取sim900发送的请求和postman发送的请求。 After the capture, compare them in detail to find out the differences, and modify the sim900 request to be the same as the postman request, conforming to http .sys rules.抓包后详细对比,找出不同之处,修改sim900请求与postman请求一样,符合http.sys规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发送第二个 POST 时 SIM900 错误 601 - SIM900 error 601 when sending a second POST 无需 SIM900 HTTP REQUEST 即可从网站向 SIM900 发送消息 - Send message from website to SIM900 without SIM900 HTTP REQUEST 使用SIM900 ATC Modam从URL获取数据 - Fetch data from url using SIM900 ATC modam 如何从http服务器发送数据到GSM / GPRS调制解调器(例如sim800,sim900,quectel m66) - How to send data to GSM/GPRS modem(e.g. sim800,sim900,quectel m66) from http server 如何将数据发送到 Web 服务器并通过 sim800 或 sim900 读取? - How can I send data to a web server and read that by sim800 or sim900? 使用SIM900将文件上传到服务器 - Upload a file to a server usin SIM900 使用Winsock库发送GET HTTP请求时出现400错误的请求错误 - 400 bad request error when send a GET http request by using winsock library 如何使用sim908 GPRS和Http POST发送数据? - How To Send Data Using sim908 GPRS with Http POST? 我收到 DioError [DioErrorType.RESPONSE]: Http status error [400] 使用 dio 和 post 方法发送表单数据请求 - I got DioError [DioErrorType.RESPONSE]: Http status error [400] when send form data using dio and post method to request Flutter HTTP POST 请求/代码 400 错误 - Flutter HTTP POST request / code 400 error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM