c# - 未找到 Azure 应用服务 ASP.NET Web API OWIN OAuth 路径
问题描述
我在 Azure 应用服务上托管一个 ASP.NET Web API。Web API 具有带有端点的 OWIN OAuth 身份验证api/token
。该 api 在 IIS 环境中运行良好。由于某种原因,当托管在 Azure 应用服务上时,令牌端点无法正常工作并导致以下错误:the controller for path 'api/token' was not found or does not implement icontroller
.
owin 启动类被调用。启动类如下所示:
OAuthBearerAuthenticationOptions OAuthBearerOptions = new OAuthBearerAuthenticationOptions();
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/api/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(authenticationElement.AccessTokenExpireTimeSpan),
Provider = provider,
RefreshTokenProvider = new GrcApiRefreshTokenProvider(),
AllowInsecureHttp = authenticationElement.AllowInsecureHttp
};
// Token Generation
app.UseOAuthAuthorizationServer(OAuthServerOptions);
//Token Consumption
app.UseOAuthBearerAuthentication(OAuthBearerOptions);
解决方案
我的解决方案是使用https
而不是http
. 尽管 owin 中间件被设置为允许不安全。
推荐阅读
- swift - 带有 if 条件的 Swift 映射函数
- java - Spring hibernate CrudRepository 根据唯一约束更新保存方法
- java - 有扩展网址吗?
- php - 从另一个驱动器上的文档根目录连接到 XAMPP MySQL 数据库
- javascript - 如何在 Vue 中的组件之间共享一些代码
- ios - UIView.transition -> Error Unexpectedly found nil
- html - 视口宽度大于 100 的 CSS @media 打印正文会缩小内容,但在 Safari 上不会
- c++ - 具有公共内存区域的类数组对象
- node.js - 如何使用电子生成器登录 Windows 安装程序
- css - 如何在 react-native 中的 Stack and Tab Navigator 中设置页眉和页脚的背景颜色