File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,13 @@ public async Task<HttpResponseMessage> CallServiceAsync(ServiceRequest serviceRe
3838 // setup headers
3939 //
4040 // 超时时间,毫秒
41- _client . Timeout = TimeSpan . FromMilliseconds ( _requestContext . ClientConfiguration . ConnectionTimeout ) ;
41+ //httpclient 默认100s
42+ // httpclient的 BaseAddress TimeOut MaxResponseContentBufferSize 属性 只能被设置一次
43+ //第二次设置就会出现异常:
44+ //“This instance has already started one or more requests.
45+ // Properties can only be modified before sending the first request.”
46+ if ( _requestContext . ClientConfiguration . ConnectionTimeout != - 1 )
47+ _client . Timeout = TimeSpan . FromMilliseconds ( _requestContext . ClientConfiguration . ConnectionTimeout ) ;
4248 foreach ( var h in serviceRequest . Headers )
4349 {
4450 bool rtn = request . Headers . TryAddWithoutValidation ( h . Key , h . Value ) ;
You can’t perform that action at this time.
0 commit comments