调用 Web API 的 Web 应用:移动到生产A web app that calls web APIs: Move to production

现在你已了解如何获取用于调用 Web API 的令牌,下面是将应用程序移到生产环境时需要考虑的一些事项。Now that you know how to acquire a token to call web APIs, here are some things to consider when moving your application to production.

启用日志记录Enable logging

为了帮助对调试和身份验证失败进行故障排除,Microsoft 身份验证库提供了内置的日志记录支持。To help in debugging and authentication failure troubleshooting scenarios, the Microsoft Authentication Library provides built-in logging support. 以下文章介绍了如何对每个库进行日志记录:Logging is each library is covered in the following articles:

一些数据收集建议如下:Here are some suggestions for data collection:

  • 用户在有问题时可能会寻求帮助。Users might ask for help when they have problems. 最佳做法是捕获日志并将其临时存储。A best practice is to capture and temporarily store logs. 提供一个供用户上传日志的位置。Provide a location where users can upload the logs. MSAL 提供日志记录扩展来捕获有关身份验证的详细信息。MSAL provides logging extensions to capture detailed information about authentication.

  • 如果遥测可用,请通过 MSAL 启用它,以收集有关用户如何登录应用的数据。If telemetry is available, enable it through MSAL to gather data about how users sign in to your app.

验证你的集成Validate your integration

按照 Microsoft 标识平台集成清单测试你的集成。Test your integration by following the Microsoft identity platform integration checklist.

后续步骤Next steps

通过试用 ASP.NET Core Web 应用的完整渐进式教程了解更多信息。Learn more by trying out the full, progressive tutorial for ASP.NET Core web apps. 本教程:The tutorial:

  • 演示如何将用户登录到多个受众或国家云,或使用社交标识登录。Shows how to sign users in to multiple audiences or to national clouds, or by using social identities.
  • 调用 Microsoft Graph。Calls Microsoft Graph.
  • 调用多个 Microsoft API。Calls several Microsoft APIs.
  • 处理增量同意。Handles incremental consent.
  • 调用自己的 Web API。Calls your own web API.

ASP.NET Core Web 应用教程ASP.NET Core web app tutorial