【问题标题】:HTTP request from angular is not hitting .Net web API ActionMethod来自 Angular 的 HTTP 请求未命中 .Net Web API ActionMethod
【发布时间】:2020-04-28 13:54:08
【问题描述】:

我已成功在.net 上应用 JWT 身份验证,当我使用 postman 时结果非常好 enter image description here

但是当我使用相同的 Url 从 Angular 调用它时,它会显示错误,因为它没有从 Angular 访问 Web API 的 Actionresult。以下是代码请帮帮我。gu enter image description here

【问题讨论】:

  • 请不要将代码发布为图片。而且你还没有展示 Angular 的实现。
  • when I called it from angular using the same Url it shows an error 请分享您在angular客户端发出请求的代码,并请在浏览器网络选项卡上查看请求的状态代码。

标签: angular asp.net-core-webapi


【解决方案1】:

这应该是 Angular 应用程序中的 url:http://localhost/59912/api/account/login。目前您使用的端点 http://localhost/59912/login 不匹配,也与您在邮递员中使用的不匹配。

【讨论】:

  • 我在我的 Angular 应用程序中使用了相同的 URL localhost/59912/api/account/Login 问题是我期待来自 Angular 应用程序的电子邮件或密码,但不幸的是我传递了电子邮件或用户密码,因为密码或用户密码不是现在问题解决了,不触发匹配动作方法。顺便感谢您的回复。
猜你喜欢
  • 2018-02-07
  • 1970-01-01
  • 1970-01-01
  • 2017-02-09
  • 1970-01-01
  • 2021-03-12
  • 1970-01-01
  • 2018-03-30
  • 2016-03-19
相关资源
最近更新 更多