【发布时间】: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