IIS中的[未找到] OAuth /令牌404。但在当地工作。

时间:2017-04-04 06:51:57

标签: angularjs asp.net-web-api oauth-2.0 iis-7.5

我在同一解决方案中使用WebAPI处理Angular。当我调用OAuth令牌方法时,它在Local中正常工作。但是,不能在IIS中工作。下面是代码。

     public void Configuration(IAppBuilder app)
    {


       IKernel kernel = IocConfig.GetKernel;
        IocConfig.RegisterIoc(GlobalConfiguration.Configuration);
        var AuthProvider = kernel.Get<DigitalSignageAuthorizationProvider>();
        app.UseOAuthAuthorizationServer(new OAuthAuthorizationServerOptions
        {
            TokenEndpointPath = new PathString("/token"),
            AccessTokenExpireTimeSpan = TimeSpan.FromDays(3),
            Provider = AuthProvider,
            AllowInsecureHttp = true,
        });
        //app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());

        var oauthConfig = new OAuthBearerAuthenticationOptions
        {
            AuthenticationMode = AuthenticationMode.Active,
            AuthenticationType = "Bearer"

        };

        app.UseOAuthBearerAuthentication(oauthConfig);

    }

Angular Code

 function userLoginToken(data) {
        var self = this;
        console.log(data);
        return self.postData('/token', data);
    }

发布数据有$ resource api调用。

0 个答案:

没有答案