[英]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.