我们在节点服务器上使用@ google-cloud / storage包,并且在打开google-cloud存储的套接字时看到间歇性连接问题。看来问题与auth有关,但是我试图弄清楚为什么会发生这种情况?我们将不胜感激任何帮助,如果有更多信息可以帮助您理解问题,请让我知道,以便如果其他人也面临同样的问题,也可以为他们提供帮助。
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Tut115</title>
</head>
<body>
<div>
@using (Html.BeginForm("Upload",
"Home",
FormMethod.Post,
new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" id="file" /><br>
<input type="submit" name="SubmitButton" value="Cancel" />
<input type="submit" name="SubmitButton" value="Upload" />
}
</div>
</body>
</html>
更多上下文:
2018-08-04T17:07:56.718075+00:00 app[web.1]: { Error: connect ETIMEDOUT 172.217.7.170:443
2018-08-04T17:07:56.718076+00:00 app[web.1]: at Object.exports._errnoException (util.js:1020:11)
2018-08-04T17:07:56.718078+00:00 app[web.1]: at exports._exceptionWithHostPort (util.js:1043:20)
2018-08-04T17:07:56.718080+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)
2018-08-04T17:07:56.718082+00:00 app[web.1]: code: 'ETIMEDOUT',
2018-08-04T17:07:56.718083+00:00 app[web.1]: errno: 'ETIMEDOUT',
2018-08-04T17:07:56.718084+00:00 app[web.1]: syscall: 'connect',
2018-08-04T17:07:56.718084+00:00 app[web.1]: address: '172.217.7.170',
2018-08-04T17:07:56.718086+00:00 app[web.1]: port: 443,
2018-08-04T17:07:56.718087+00:00 app[web.1]: config:
2018-08-04T17:07:56.718088+00:00 app[web.1]: { adapter: [Function: httpAdapter],
2018-08-04T17:07:56.718089+00:00 app[web.1]: transformRequest: { '0': [Function: transformRequest] },
2018-08-04T17:07:56.718091+00:00 app[web.1]: transformResponse: { '0': [Function: transformResponse] },
2018-08-04T17:07:56.718091+00:00 app[web.1]: timeout: 0,
2018-08-04T17:07:56.718092+00:00 app[web.1]: xsrfCookieName: 'XSRF-TOKEN',
2018-08-04T17:07:56.718093+00:00 app[web.1]: xsrfHeaderName: 'X-XSRF-TOKEN',
2018-08-04T17:07:56.718095+00:00 app[web.1]: validateStatus: [Function: validateStatus],
2018-08-04T17:07:56.718094+00:00 app[web.1]: maxContentLength: -1,
2018-08-04T17:07:56.718096+00:00 app[web.1]: headers:
2018-08-04T17:07:56.718097+00:00 app[web.1]: { Accept: 'application/json, text/plain, */*',
2018-08-04T17:07:56.718098+00:00 app[web.1]: 'Content-Type': 'application/x-www-form-urlencoded',
2018-08-04T17:07:56.718099+00:00 app[web.1]: 'User-Agent': 'axios/0.18.0',
2018-08-04T17:07:56.718100+00:00 app[web.1]: 'Content-Length': 827 },
2018-08-04T17:07:56.718101+00:00 app[web.1]: method: 'post',
2018-08-04T17:07:56.718102+00:00 app[web.1]: url: 'https://www.googleapis.com/oauth2/v4/token',
2018-08-04T17:07:56.718104+00:00 app[web.1]: data: '...'},
2018-08-04T17:07:56.718105+00:00 app[web.1]: request:
2018-08-04T17:07:56.718106+00:00 app[web.1]: Writable {
2018-08-04T17:07:56.718107+00:00 app[web.1]: _writableState:
2018-08-04T17:07:56.718108+00:00 app[web.1]: WritableState {
2018-08-04T17:07:56.718109+00:00 app[web.1]: objectMode: false,
2018-08-04T17:07:56.718110+00:00 app[web.1]: highWaterMark: 16384,
2018-08-04T17:07:56.718111+00:00 app[web.1]: needDrain: false,
2018-08-04T17:07:56.718111+00:00 app[web.1]: ending: false,
2018-08-04T17:07:56.718112+00:00 app[web.1]: ended: false,
2018-08-04T17:07:56.718113+00:00 app[web.1]: finished: false,
2018-08-04T17:07:56.718114+00:00 app[web.1]: decodeStrings: true,
2018-08-04T17:07:56.718115+00:00 app[web.1]: defaultEncoding: 'utf8',
2018-08-04T17:07:56.718116+00:00 app[web.1]: length: 0,
2018-08-04T17:07:56.718117+00:00 app[web.1]: writing: false,
2018-08-04T17:07:56.718118+00:00 app[web.1]: sync: true,
2018-08-04T17:07:56.718118+00:00 app[web.1]: corked: 0,
2018-08-04T17:07:56.718119+00:00 app[web.1]: bufferProcessing: false,
2018-08-04T17:07:56.718120+00:00 app[web.1]: onwrite: [Function],
2018-08-04T17:07:56.718121+00:00 app[web.1]: writecb: null,
2018-08-04T17:07:56.718122+00:00 app[web.1]: writelen: 0,
2018-08-04T17:07:56.718123+00:00 app[web.1]: bufferedRequest: null,
2018-08-04T17:07:56.718124+00:00 app[web.1]: lastBufferedRequest: null,
2018-08-04T17:07:56.718125+00:00 app[web.1]: pendingcb: 0,
2018-08-04T17:07:56.718126+00:00 app[web.1]: prefinished: false,
2018-08-04T17:07:56.718127+00:00 app[web.1]: errorEmitted: false,
2018-08-04T17:07:56.718128+00:00 app[web.1]: bufferedRequestCount: 0,
2018-08-04T17:07:56.718129+00:00 app[web.1]: corkedRequestsFree: [Object] },
2018-08-04T17:07:56.718130+00:00 app[web.1]: writable: true,
2018-08-04T17:07:56.718131+00:00 app[web.1]: domain: null,
2018-08-04T17:07:56.718132+00:00 app[web.1]: _events:
2018-08-04T17:07:56.718133+00:00 app[web.1]: { response: [Function: handleResponse],
2018-08-04T17:07:56.718134+00:00 app[web.1]: error: [Function: handleRequestError] },
2018-08-04T17:07:56.718135+00:00 app[web.1]: _eventsCount: 2,
2018-08-04T17:07:56.718136+00:00 app[web.1]: _maxListeners: undefined,
2018-08-04T17:07:56.718137+00:00 app[web.1]: _options:
2018-08-04T17:07:56.718137+00:00 app[web.1]: { protocol: 'https:',
2018-08-04T17:07:56.718138+00:00 app[web.1]: maxRedirects: 21,
2018-08-04T17:07:56.718139+00:00 app[web.1]: maxBodyLength: 10485760,
2018-08-04T17:07:56.718140+00:00 app[web.1]: path: '/oauth2/v4/token',
2018-08-04T17:07:56.718141+00:00 app[web.1]: method: 'post',
2018-08-04T17:07:56.718142+00:00 app[web.1]: headers: [Object],
2018-08-04T17:07:56.718143+00:00 app[web.1]: agent: undefined,
2018-08-04T17:07:56.718144+00:00 app[web.1]: auth: undefined,
2018-08-04T17:07:56.718145+00:00 app[web.1]: hostname: 'www.googleapis.com',
2018-08-04T17:07:56.718145+00:00 app[web.1]: port: null,
2018-08-04T17:07:56.718146+00:00 app[web.1]: nativeProtocols: [Object],
2018-08-04T17:07:56.718147+00:00 app[web.1]: pathname: '/oauth2/v4/token' },
2018-08-04T17:07:56.718148+00:00 app[web.1]: _redirectCount: 0,
2018-08-04T17:07:56.718149+00:00 app[web.1]: _redirects: [],
2018-08-04T17:07:56.718150+00:00 app[web.1]: _requestBodyLength: 827,
2018-08-04T17:07:56.718150+00:00 app[web.1]: _requestBodyBuffers: [ [Object] ],
2018-08-04T17:07:56.718151+00:00 app[web.1]: _onNativeResponse: [Function],
2018-08-04T17:07:56.718152+00:00 app[web.1]: _currentRequest:
2018-08-04T17:07:56.718153+00:00 app[web.1]: ClientRequest {
2018-08-04T17:07:56.718154+00:00 app[web.1]: domain: null,
2018-08-04T17:07:56.718155+00:00 app[web.1]: _events: [Object],
2018-08-04T17:07:56.718156+00:00 app[web.1]: _eventsCount: 6,
2018-08-04T17:07:56.718156+00:00 app[web.1]: _maxListeners: undefined,
2018-08-04T17:07:56.718157+00:00 app[web.1]: output: [],
2018-08-04T17:07:56.718158+00:00 app[web.1]: outputEncodings: [],
2018-08-04T17:07:56.718159+00:00 app[web.1]: outputCallbacks: [],
2018-08-04T17:07:56.718160+00:00 app[web.1]: outputSize: 0,
2018-08-04T17:07:56.718161+00:00 app[web.1]: writable: true,
2018-08-04T17:07:56.718162+00:00 app[web.1]: _last: true,
2018-08-04T17:07:56.718163+00:00 app[web.1]: upgrading: false,
2018-08-04T17:07:56.718164+00:00 app[web.1]: chunkedEncoding: false,
2018-08-04T17:07:56.718165+00:00 app[web.1]: shouldKeepAlive: false,
2018-08-04T17:07:56.718166+00:00 app[web.1]: useChunkedEncodingByDefault: true,
2018-08-04T17:07:56.718167+00:00 app[web.1]: sendDate: false,
2018-08-04T17:07:56.718168+00:00 app[web.1]: _removedHeader: [Object],
2018-08-04T17:07:56.718169+00:00 app[web.1]: _contentLength: null,
2018-08-04T17:07:56.718170+00:00 app[web.1]: _hasBody: true,
2018-08-04T17:07:56.718171+00:00 app[web.1]: _trailer: '',
2018-08-04T17:07:56.718171+00:00 app[web.1]: finished: false,
2018-08-04T17:07:56.718172+00:00 app[web.1]: _headerSent: true,
2018-08-04T17:07:56.718173+00:00 app[web.1]: socket: [Object],
2018-08-04T17:07:56.718174+00:00 app[web.1]: connection: [Object],
2018-08-04T17:07:56.718180+00:00 app[web.1]: _header: 'POST /oauth2/v4/token HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nContent-Type: application/x-www-form-urlencoded\r\nUser-Agent: axios/0.18.0\r\nContent-Length: 827\r\nHost: www.googleapis.com\r\nConnection: close\r\n\r\n',
2018-08-04T17:07:56.718182+00:00 app[web.1]: _headerNames: [Object],
2018-08-04T17:07:56.718181+00:00 app[web.1]: _headers: [Object],
2018-08-04T17:07:56.718183+00:00 app[web.1]: _onPendingData: null,
2018-08-04T17:07:56.718184+00:00 app[web.1]: agent: [Object],
2018-08-04T17:07:56.718185+00:00 app[web.1]: socketPath: undefined,
2018-08-04T17:07:56.718186+00:00 app[web.1]: timeout: undefined,
2018-08-04T17:07:56.718186+00:00 app[web.1]: method: 'POST',
2018-08-04T17:07:56.718187+00:00 app[web.1]: path: '/oauth2/v4/token',
2018-08-04T17:07:56.718188+00:00 app[web.1]: _ended: false,
2018-08-04T17:07:56.718189+00:00 app[web.1]: _redirectable: [Circular],
2018-08-04T17:07:56.718190+00:00 app[web.1]: parser: null },
2018-08-04T17:07:56.718191+00:00 app[web.1]: _currentUrl: 'https://www.googleapis.com/oauth2/v4/token' },
2018-08-04T17:07:56.718192+00:00 app[web.1]: response: undefined }
正在创建套接字的代码:
node 6.11
deployed on heroku
然后在整个代码中的多个地方使用此功能。