动态 HttpClient 调用永远不会成功 [英] Dynamics HttpClient call never succeeds

查看:50
本文介绍了动态 HttpClient 调用永远不会成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个业务中央控制插件,我需要在其中调用外部 Web 服务.为此,我使用 HttpClient 类在 AL 中,但没有调用成功.

I am developing a business central control add in where I need to call external web services. For this, I am using the HttpClient class in AL but no call succeeds.

if not Client.Get('https://google.com', Response)
    then begin
        responseText := Response.ReasonPhrase();
        Message(responseText);
        Error('didnt work');
    end;

完成通话大约需要 2.5-3 分钟.ResponseText 为OK",HttpStatusCode 为200",但调用始终失败并进入错误处理块.

It takes about 2.5-3 Minutes to finish the call. ResponseText is 'OK' and HttpStatusCode is '200' but the call always fails and goes into error handling block.

使用 Response.Content.ReadAs(responseText); 读取响应失败并显示动态错误消息.

Reading the response with Response.Content.ReadAs(responseText); fails with a dynamics error message.

我错过了什么?我已经在扩展管理中授予外部访问权限,并尝试使用沙盒和最新 2019 年的本地安装.

What am I missing? I already granted external access in extension management and tried with sandbox and on premise installs of latest 2019.

推荐答案

转到扩展管理,选择您的扩展,然后从管理"菜单中选择配置".在配置"页面中,将 AllowHttpCleintRequest 设置为 True.

Go to extension management, select your extension and from Manage menu, select Configure. In the Configure page, set AllowHttpCleintRequest to True.

这篇关于动态 HttpClient 调用永远不会成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆