如何在Visual Studio 2019上向Odata Microsoft Dynamics Web服务添加凭据

发布于 2025-01-27 02:21:06 字数 602 浏览 4 评论 0原文

Microsoft Dynamic Web服务链接在浏览器上使用时提示凭据如下图所示

问题是如何将此凭据传递给Visual Studio,以避免未经授权的响应

”在此处输入image

我尝试过:

Authorisation:Basic
username: valid username
password: valid password

在自定义标题文本框上,滴答了ticked tick tick tick tick uncul ofuck http headers http headers

The Microsoft dynamic web service link when used on a browser prompts the Credentials as shown in the image below
enter image description here

The issue is how to pass this credential to Visual studio in order to avoid the Unauthorized response

enter image description here

I have tried:

Authorisation:Basic
username: valid username
password: valid password

on the Custom Headers textbox, having ticked include custom http headers

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

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

发布评论

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

评论(1

我的奇迹 2025-02-03 02:21:06

此相关帖子,您可以按以下方式提供用户凭据:

var client = new RestClient(Url);
var request = new RestRequest(Method.GET);
client.FollowRedirects = true;
client.Timeout = -1;
client.PreAuthenticate = true;
request.Credentials = new NetworkCredential(User, Password);

您已经替换了动态系统的域名,带有其IP地址。确保该服务实际上处于活动状态。是否有任何访问限制可以阻止用户调用此服务?检查服务器端的事件日志条目。

Postman 测试连接/凭据。
这样的测试可以排除代码之外的问题。
如果 Postman 能够执行一个成功的呼叫,那么您的代码是罪魁祸首。

Campany在服务URL中未正确拼写?

As explained in this related post, you can supply the user credentials as follows:

var client = new RestClient(Url);
var request = new RestRequest(Method.GET);
client.FollowRedirects = true;
client.Timeout = -1;
client.PreAuthenticate = true;
request.Credentials = new NetworkCredential(User, Password);

You already replaced the domain name of the Dynamics system with its IP address. Make sure that the service is actually active. Are there any access restrictions in place which prevent the user from calling this service? Check the event log entries on the server side.

Test the connection/credentials with postman.
Such a test can rule-out problems outside your code.
If postman is able to perform a sucessful call, your code is the culprit.

Campany in the service URL is not spelled correctly?

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