我知道这是一个奇怪的问题,但是我们正在敲打墙头3天了!
我们有几个月在IIS上运行的web api应用程序(asp.net 4 c#)没有问题。 从某一天起,我们的一些客户表示他们不再消费api了。
经过一些(很多......)的调查后,这个问题似乎成了api的一个帖子。奇怪的是它与wi-fi或3G没有任何问题。只有来自特定运营商的3G似乎不起作用。
这是对从同一平板电脑到同一服务器的两个请求的标题进行比较,第一个是wi-fi,后者是3G。
****************** WIFI(回复:200)
- Http: Request, POST /api_name/delivery , Using Basic Authorization
Command: POST
- URI: /api_name/delivery
Location: /api_name/delivery
ProtocolVersion: HTTP/1.1
UserAgent: App_Android
ContentLength: 9788
- ContentType: multipart/form-data; boundary=u3_y3iyl55Ep7eN3jnrrCX9i_rNK4z1XBPipaq
- MediaType: multipart/form-data; boundary=u3_y3iyl55Ep7eN3jnrrCX9i_rNK4z1XBPipaq
MainType: multipart/form-data
- MimeBoundary: u3_y3iyl55Ep7eN3jnrrCX9i_rNK4z1XBPipaq
Boundary: u3_y3iyl55Ep7eN3jnrrCX9i_rNK4z1XBPipaq
Host: some_ip:80
Connection: Keep-Alive
- Authorization: Basic
- Authorization: Basic dGVzdDp0ZXN0
WhiteSpace:
- BasicAuthorization:
Scheme: Basic
- Realm: test:test
- Realm: test:test
UserId: test
PassWord: test
HeaderEnd: CRLF
- MimeBody: multipart
Boundary: --u3_y3iyl55Ep7eN3jnrrCX9i_rNK4z1XBPipaq
- MultiPartEntity: Content-Disposition: form-data; name="Data"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
- Content-Disposition: form-data; name="Data"
Mainpart: form-data; name="Data"
- ContentType: text/plain; charset=US-ASCII
MediaType: text - textual information
- SubContentType: plain; charset=US-ASCII
SubType: plain - text containing no formatting commands or directives of any sort
Parameters: charset=US-ASCII
- Content-Transfer-Encoding: 8bit
Mainpart: 8bit
HeaderEnd: CRLF
**************** CELL(响应400错误请求 - 动词无效)
- Http: Request, POST /api_name/delivery , Using Basic Authorization
Command: POST
- URI: /api_name/delivery
Location: /api_name/delivery
ProtocolVersion: HTTP/1.1
- Authorization: Basic
- Authorization: Basic dGVzdDp0ZXN0
WhiteSpace:
- BasicAuthorization:
Scheme: Basic
- Realm: test:test
- Realm: test:test
UserId: test
PassWord: test
Host: some_ip:80
UserAgent: App_Android
ContentLength: 9786
- ContentType: multipart/form-data;boundary=bAwxUZAdKQlR5y4yyDOQVgV4Xxj9rhAdW33CV
- MediaType: multipart/form-data;boundary=bAwxUZAdKQlR5y4yyDOQVgV4Xxj9rhAdW33CV
MainType: multipart/form-data
- MimeBoundary: bAwxUZAdKQlR5y4yyDOQVgV4Xxj9rhAdW33CV
Boundary: bAwxUZAdKQlR5y4yyDOQVgV4Xxj9rhAdW33CV
Connection: Keep-Alive
HeaderEnd: CRLF
这是来自应用程序的logcat
10-01 19:16:10.859: D/PostDeliveryRequest(23353): error: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
10-01 19:16:10.859: D/PostDeliveryRequest(23353): <HTML><HEAD><TITLE>Bad Request</TITLE>
10-01 19:16:10.859: D/PostDeliveryRequest(23353): <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
10-01 19:16:10.859: D/PostDeliveryRequest(23353): <BODY><h2>Bad Request - Invalid Verb</h2>
10-01 19:16:10.859: D/PostDeliveryRequest(23353): <hr><p>HTTP Error 400. The request verb is invalid.</p>
10-01 19:16:10.859: D/PostDeliveryRequest(23353): </BODY></HTML>
你看到一些奇怪的东西吗?
谢谢Stefano