[英]after publishing blazor-server app to server cannot get result from testnet.binance.vision [works in localhost]
This is error after publishing to the server [UBUNTU]这是发布到服务器后的错误 [UBUNTU]
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 'YT-5hUsabWHhqsnewYD0_YAdubDWkaPxkx144q2ZYN0'.
Binance.Common.BinanceClientException: Exception of type 'Binance.Common.BinanceClientException' was thrown.
at Binance.Common.BinanceService.SendAsync[T](String requestUri, HttpMethod httpMethod, Object content)
at Binance.Common.BinanceService.SendPublicAsync[T](String requestUri, HttpMethod httpMethod, Dictionary`2 query, Object content)
at Binance.Spot.Market.CurrentAveragePrice(String symbol)
at TORCHAIN.Components.CryptoTracker.PricesComponent.OnInitializedAsync() in A:\Users\sam_sepi0l\Desktop\PROJECTS\NEWFORUM\TORCHAIN\Components\CryptoTracker\PricesComponent.razor.cs:line 25
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
This is 25 line:这是 25 行:
var result = await market.CurrentAveragePrice(symbol);
At localhost it works perfectly and i get result but after publishing it says this error.在本地主机上,它运行完美,我得到了结果,但在发布后它说这个错误。
This is method call:这是方法调用:
private static HttpClient _httpClient = new HttpClient();
public List<string> Lista = new List<string>();
protected async override Task OnInitializedAsync()
{
#region BinanceAPI
using (_httpClient = new HttpClient())
{
_httpClient.BaseAddress = new Uri("https://testnet.binance.vision");
_httpClient.Timeout = new TimeSpan(0, 0, 5);
_httpClient.DefaultRequestHeaders.Clear();
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
_httpClient.DefaultRequestHeaders.Add("X-MBX-APIKEY", "APIKEY");
_httpClient.DefaultRequestHeaders.Add("SecretKey", "SECRETKEY");
var symbol = "BTCBUSD";
var market = new Market(_httpClient);
var result = await market.CurrentAveragePrice(symbol);
BinancePrice? Token = JsonConvert.DeserializeObject<BinancePrice>(result);
Lista.Add(Token!.Price.ToString());
}
#endregion
}
##UPDATE ##更新
I think this is problem with linux. Maybe some proxy or something i should to turn on or turn off?我认为这是 linux 的问题。也许是一些代理或我应该打开或关闭的东西?
There was problem with server location and sanctions from binance.服务器位置和 binance 的制裁存在问题。 i changed location to europe from america and it works.
我将位置从美国更改为欧洲并且它有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.