runtime.com.pilerservices.taskawaiter.throwfornonsuccess

发布于 2025-02-10 05:06:01 字数 1638 浏览 2 评论 0原文

我正在运行.NET应用程序,该应用程序从SQL数据库中获取数据并在表单屏幕上显示。 当我在UAT中运行该应用程序时,它可以正常工作,但是在产品中,我要低于异常

查询在数据库上正常运行良好,但是我得到了此例外。

PricingClinet.cs-

 public async Task<SaveResponse> SaveAsync(Sheet sheet)
        {
            SaveResponse result = null;

            try
            {
                var response = await _client.PostAsJsonAsync("Pricing/Save", sheet);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var jsonResult = await response.Content.ReadAsStringAsync();

                    result = JsonConvert.DeserializeObject<SaveResponse>(jsonResult);
                }
                else
                {
                    var errorMessage = string.Format("StatusCode: {0}\r\n{1}", response.StatusCode.ToString(), response.ReasonPhrase);
                    Logger.LogError(errorMessage);
                    result = new SaveResponse()
                    {
                        Success = false,
                        ErrorMessage = errorMessage
                    };
                }
            }
            catch (Exception error)
            {
                Logger.LogError(error);
                result = new SaveResponse()
                {
                    Success = false,
                    ErrorMessage = ExceptionManager.RenderErrorMessage(error)
                };
            }

            return result;
        }

此错误仅在prod中而不是在UAT中。

I am running .net application which fetches data from SQL database and displays on the form screen.
When I run the application in UAT, it works fine but in PROD, I am getting below exception
Error

Query run fine on database but I am getting this exception.

PricingClinet.cs -

 public async Task<SaveResponse> SaveAsync(Sheet sheet)
        {
            SaveResponse result = null;

            try
            {
                var response = await _client.PostAsJsonAsync("Pricing/Save", sheet);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var jsonResult = await response.Content.ReadAsStringAsync();

                    result = JsonConvert.DeserializeObject<SaveResponse>(jsonResult);
                }
                else
                {
                    var errorMessage = string.Format("StatusCode: {0}\r\n{1}", response.StatusCode.ToString(), response.ReasonPhrase);
                    Logger.LogError(errorMessage);
                    result = new SaveResponse()
                    {
                        Success = false,
                        ErrorMessage = errorMessage
                    };
                }
            }
            catch (Exception error)
            {
                Logger.LogError(error);
                result = new SaveResponse()
                {
                    Success = false,
                    ErrorMessage = ExceptionManager.RenderErrorMessage(error)
                };
            }

            return result;
        }

This error is hapenning in PROD only, not in UAT.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千纸鹤 2025-02-17 05:06:01

这是等待_client.postasjsonasync的超时。

您需要确认您的产品配置是正确的,例如指向正确的服务器。

如果您的配置正确,则需要增加超时
(例如_client.TimeOut = ...)或更快地进行远程调用(如果显然在您的控件中)。

This is a timeout in a await _client.PostAsJsonAsync.

You need to confirm that your PROD configuration is correct e.g. points to the correct server.

If your configuration is correct then you need to either increase the timeout
(e.g. _client.Timeout = ...) or make the remote call faster (if it's in your control obviously).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文