no post表示服务器没有显示,为什么在Internet Explorer中没有收到POST响应数据?

I have an AngularJS web app that accesses a .NET WebAPI server end. Authentication is implemented through the AngularJS-OAuth2 library. I have the app and the WebAPI hosted in localhost under two different port numbers. I have also enabled Microsoft.Owin.Cors package on the server end to handle cross-domain requests.

我有一个AngularJS web应用程序可以访问。net WebAPI服务器端。身份验证是通过AngularJS-OAuth2库实现的。我将应用程序和WebAPI托管在localhost中,并使用两个不同的端口号。我还启用了Microsoft.Owin。服务器端的Cors包处理跨域请求。

In Chrome, GET and POST requests return data to the front-end. By inspecting the traffic through Fiddler I could see that a pair of requests/responses are sent (preflight/OPTIONS + actual) and also the relevant CORS headers (including origin and Access-Control-* headers) in both the requests and the responses. All as expected.

在Chrome中,GET和POST请求返回数据到前端。通过Fiddler检查通信量,我可以看到在请求和响应中发送了一对请求/响应(飞行前/选项+实际)和相关的CORS报头(包括起源和访问控制-*报头)。像预期的那样。

However, in Internet Explorer, my GET requests return data through the $http service but the POST does not. I could inspect that there are no preflight requests or CORS headers (I think IE treats different ports as the same origin). In checking the POST request/response in IE through Fiddler I could observe that it returns HTTP status 200 but state of Aborted (with X-ABORTED-WHEN: SendingResponse flag set). I could also inspect the JSON response with the correct data returned.

然而,在Internet Explorer中,我的GET请求通过$http服务返回数据,但是POST不返回。我可以检查没有飞行前请求或CORS报头(我认为IE将不同的端口视为相同的源)。在通过Fiddler检查IE中的POST请求/响应时,我可以观察到它返回HTTP状态200,但处于中止状态(X-ABORTED-WHEN: SendingResponse标志设置)。我还可以使用返回的正确数据检查JSON响应。

I have also tried setting a high timeout to no avail. The $http call looks like this:

我也尝试过设置一个高超时,但没有任何效果。$http调用如下所示:

return $http.post(apiUrl + "/search", service.getParameters(), { timeout: 600000 })

.success(function (data) {...

Fiddler shows something like this for the IE POST request:

Fiddler为IE POST请求显示如下内容:

aHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9hYU10Yy5wbmc=

Also (only) in IE, an unintentional page refresh is also triggered with the same button click as this POST operation.

同样(仅)在IE中,通过与此POST操作相同的按钮单击,也会触发无意的页面刷新。

Why does Internet Explorer abort only the POST requests when the correct data is also returned to the client and when Chrome does not have any issues at all?

当正确的数据被返回给客户端并且Chrome没有任何问题时,为什么ie只中止POST请求?

Additional Information

额外的信息

Request:

要求:

POST https://localhost:44321/api//search HTTP/1.1

Content-Type: application/json;charset=utf-8

Accept: application/json, text/plain, */*

Authorization: Bearer

Referer: https://localhost:44322/search

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko

Host: localhost:44321

Content-Length: 202

DNT: 1

Connection: Keep-Alive

Cache-Control: no-cache

Cookie: .ASPXANONYMOUS=

Reponse:

响应:

HTTP/1.1 200 OK

Cache-Control: no-cache

Pragma: no-cache

Content-Type: application/json; charset=utf-8

Expires: -1

Server: Microsoft-IIS/10.0

X-AspNet-Version: 4.0.30319

X-SourceFiles:

X-Powered-By: ASP.NET

Date: Wed, 10 Feb 2016 13:43:45 GMT

Content-Length: 2284

Fiddler session properties:

提琴手会话属性:

SESSION STATE: Aborted.

Request Entity Size: 202 bytes.

Response Entity Size: 2284 bytes.

== FLAGS ==================

BitFlags: [IsHTTPS, ClientPipeReused, ServerPipeReused] 0x19

X-ABORTED-WHEN: SendingResponse

X-CLIENTIP: 127.0.0.1

X-CLIENTPORT: 41889

X-EGRESSPORT: 41890

X-HOSTIP: ::1

X-PROCESSINFO: avp:3584

X-RESPONSEBODYTRANSFERLENGTH: 2,284

X-SERVERSOCKET: REUSE ServerPipe#168

== TIMING INFO ============

ClientConnected: 19:13:42.408

ClientBeginRequest: 19:13:42.444

GotRequestHeaders: 19:13:42.444

ClientDoneRequest: 19:13:42.772

Determine Gateway: 0ms

DNS Lookup: 0ms

TCP/IP Connect: 0ms

HTTPS Handshake: 0ms

ServerConnected: 19:13:42.413

FiddlerBeginRequest: 19:13:42.772

ServerGotRequest: 19:13:42.772

ServerBeginResponse: 19:13:45.360

GotResponseHeaders: 19:13:45.360

ServerDoneResponse: 19:13:45.360

ClientBeginResponse: 19:13:45.360

ClientDoneResponse: 19:13:45.360

Overall Elapsed: 0:00:02.915

The response was buffered before delivery to the client.

== WININET CACHE INFO ============

This URL is not present in the WinINET cache. [Code: 2]

* Note: Data above shows WinINET's current cache state, not the state at the time of the request.

* Note: Data above shows WinINET's Medium Integrity (non-Protected Mode) cache only.

1 个解决方案

#1

2

I believe you get bitten by the P3P policy requirement of IE here:

我相信你被IE的P3P政策要求给咬了:

Internet Explorer supports a cookie-restricting privacy feature called P3P. Web developers often get tripped up by it because no other browser implements the P3P standard.

Internet Explorer支持限制cookie的隐私特性P3P。Web开发人员经常被它绊倒,因为没有其他浏览器实现P3P标准。

It seems similar to those QAs:

这似乎与QAs相似:

Here's a blog post with an example how to send P3P information. Here's a document from Microsoft about P3P configuration

这是一篇关于如何发送P3P信息的博客文章。这是微软关于P3P配置的文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值