【问题标题】:Azure App Service ASP.NET Web API OWIN OAuth path not found未找到 Azure 应用服务 ASP.NET Web API OWIN OAuth 路径
【发布时间】:2018-06-04 15:41:50
【问题描述】:

我在 Azure 应用服务上托管一个 ASP.NET Web API。 Web API 具有端点 api/token 的 OWIN OAuth 身份验证。该 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);

【问题讨论】:

    标签: c# azure asp.net-web-api azure-web-app-service owin


    【解决方案1】:

    我的解决方案是使用https 而不是http。尽管 owin 中间件被设置为允许不安全。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-26
      • 1970-01-01
      • 2016-05-04
      • 2021-09-24
      • 1970-01-01
      • 1970-01-01
      • 2017-08-16
      • 2020-10-21
      相关资源
      最近更新 更多