简体   繁体   English

找不到Azure应用服务ASP.NET Web API OWIN OAuth路径

[英]Azure App Service ASP.NET Web API OWIN OAuth path not found

I am hosting an ASP.NET Web API on Azure App Service. 我在Azure App Service上托管ASP.NET Web API。 The Web API has OWIN OAuth authentication with an endpoint api/token . Web API具有带有端点api/token OWIN OAuth身份验证。 The api runs fine in an IIS environment. 该api在IIS环境中运行良好。 For some reason when hosted on Azure App Service the token endpoint isn't working and results in the following error: the controller for path 'api/token' was not found or does not implement icontroller . 由于某些原因,当托管在Azure App Service上时,令牌终结点无法正常工作并导致以下错误: the controller for path 'api/token' was not found or does not implement icontroller

The owin startup class is called. OWIN启动类被调用。 The startup class looks as followed: 启动类如下所示:

 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);

The solution for me was to use https instead of http . 对我来说,解决方案是使用https而不是http Altough the owin middleware was set to allow insecure. owin中间件的所有设置都允许不安全。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法发布 ASP.NET Web API 到 Z3A580F142203677F1FZ3 应用服务 - Cannot publish ASP.NET Web API to Azure App Service Asp.Net API 2 Ninject和OWIN OAuth配置 - Asp.Net API 2 Ninject and OWIN OAuth Configuration ASP.NET Web-API OWIN:找不到与请求URI匹配的HTTP资源 - ASP.NET Web-API OWIN: No HTTP resource was found that matches the request URI Owin selfhost asp.net Web API作为服务启动时拒绝连接 - Owin selfhost asp.net Web api refuse connection when started as a service 无法发布 ASP.NET Web API 到 Azure 应用服务(带 SwashBuckle) - Cannot publish ASP.NET Web API to Azure App Service (with SwashBuckle) 如何在ASP.NET Core 6.0 Web API中读取Azure App服务的应用设置 - How to read application setting of Azure App service in ASP.NET Core 6.0 Web API ASP.NET Web APP 和 Web API 无限重定向循环中的 Azure AD Open ID Connect OAuth 2.0 - Azure AD Open ID Connect OAuth 2.0 in ASP.NET Web APP and Web API Infinite redirect loop Azure SignalR 服务 | Asp.Net Web Api | 控制台客户端 - Azure SignalR Service | Asp.Net Web Api | Console client 将ASP.NET Core部署到Azure Web App服务错误 - Deploy ASP.NET Core to Azure Web App Service Error ASP.NET Web Api 2.0中的Owin自定义路由MIddleware - Owin Custom Routing MIddleware in ASP.NET Web Api 2.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM