本文介绍了致命错误:未捕获异常'异常',消息'由同行重置TCP连接'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是Bing Ads API的新用户。我在下面的PHP文章中遵循服务器端OAuth身份验证来获取授权代码,然后使用它来获取访问令牌和刷新令牌。


I am new to Bing Ads API. I followed the server side OAuth authentication in PHP article below to get authorization code and then use it to obtain access token and refresh token.

http://msdn.microsoft.com/en-US/library/dn632721.aspx

http://msdn.microsoft.com/en-US/library/dn632721.aspx

我可以获得授权代码,但是当我使用授权代码进行HTTP POST以获取访问权限并刷新令牌时,我在显示的行中的OAuth2Callback.php中收到"通过对等方重置TCP连接"错误下面。

I am able to get authorization code, but when I am doing a HTTP POST with the authorization code to get access and refresh tokens, I am receiving a 'TCP connection reset by peer' error in OAuth2Callback.php at the line displayed below.

$responseJson = $httpClient->postData(
    $accessTokenExchangeUrl,
    $accessTokenExchangeParams);

致命错误:在/var/app/current/bingads/src/OAuth2Callback.php:44中消息"异常的TCP连接重置"的未捕获异常"异常"堆栈跟踪:#0 / var / app / current /bingads/src/OAuth2Callback.php(89):HttpClient-> postData('https://login.l ...',
数组)在#var / app / current中抛出#1 {main}第44行/bingads/src/OAuth2Callback.php

Fatal error: Uncaught exception 'Exception' with message 'TCP connection reset by peer' in /var/app/current/bingads/src/OAuth2Callback.php:44 Stack trace: #0 /var/app/current/bingads/src/OAuth2Callback.php(89): HttpClient->postData('https://login.l...', Array) #1 {main} thrown in /var/app/current/bingads/src/OAuth2Callback.php on line 44

2周前,我能够完成同样的Oauth工作流程,没有任何问题。突然,它给了我这个错误。有没有专家可以对此有所了解?我的应用程序托管在Amazon ElasticBeanstalk环境中。

I was able to go through this same Oauth workflow 2 weeks ago with no issue. Suddenly, it's giving me this error. Could any expert here shed some light on this? My application is hosted in Amazon ElasticBeanstalk environment.

非常感谢

推荐答案

如果我在shell中使用CURL来获取应该给你access_token和refresh_token的端点,如:

If I use CURL in the shell to GET the endpoint that is supposed to give you access_token and refresh_token like:

https://login.live.com/oauth20_token.srf?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&code=CODE&grant_type=authorization_code&redirect_uri=REDIRECTURI

我得到"卷曲:(35 )通过对等方重置TCP连接"。

------------------ ----

`curl --version`

curl 7.38.0(x86_64-redhat-linux-gnu)libcurl / 7.38.0 NSS / 3.16.2基本ECC z lib / 1.2.7 libidn / 1.18 libssh2 / 1.4.2

协议:dict文件ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp 

功能:AsynchDNS IDN IPv6大文件GSS-API SPNEGO NTLM NTLM_WB SSL libz

- ----------------------

-----------------------

当从Amazon EC2 East(弗吉尼亚州)进行CURLing时会发生这种情况来自Amazon EC2 West(俄勒冈州)。

This happens when CURLing from Amazon EC2 East (Virginia) and from Amazon EC2 West (Oregon).

如果我在本地运行命令(OS X,curl 7.39.0),数据将成功返回。

If I run the command locally (OS X, curl 7.39.0), data is returned successfully.


这篇关于致命错误:未捕获异常'异常',消息'由同行重置TCP连接'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 07:16