简体   繁体   English

将 blazor-server 应用程序发布到服务器后无法从 tes.net.binance.vision 获得结果 [在本地主机工作]

[英]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.

相关问题 在基本路径中使用 BlazorHub 的 Blazor-Server 通知? - Blazor-Server Notifications with BlazorHub in base path? 在服务器上工作,但发布后出现错误 - On server works but after the publishing i get an error 如何在使用布尔值列表的 Blazor 服务器应用程序中添加动态复选框? - How to add dynamic checkboxes in a Blazor-server app that use a list of booleans? 为什么我的 Blazor 服务器页面在发布到 IIS 后为空? - Why is my Blazor Server page empty after publishing to IIS? 在 AWS 上部署 blazor 服务器应用程序“错误:如果连接不在‘已连接’State 中,则无法发送数据。” 但适用于本地主机 - Deployed blazor server app on AWS “Error: Cannot send data if the connection is not in the 'Connected' State.” But works on local host 如何在 blazor webassembly 应用程序中获取服务器 url? - How to get the server url in blazor webassembly app? Blazor Webassembly 应用程序显示来自服务器的图像 - Blazor Webassembly App display image from server 使用 Blazor 应用从服务器下载文件 - Download File from Server with Blazor App 试图从 Blazor 服务器应用调用 js - Attempting to call js from Blazor Server App 无法使用 Blazor 服务器应用程序调用安全下游 Web API 使用 Azure AD B2C - Cannot get a Blazor Server App to call a secure downstream Web API using Azure AD B2C
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM