Authorization has been denied for this request - New Web API Project

前端 未结 4 793
渐次进展
渐次进展 2021-01-30 10:58

I just created new Web API project (using MVC) in visual studio 2015 and for the testing purpose, I ran that project but ended up below error.

After running the project,

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 11:40

    In the ValuesController there is an attribute Authorize if you remove it, then it will work as home page.

    The Authorize attribute just prevent an anonymous users from accessing the ValuesController.

    to work with this attribute, you need first to register a user, and then login to get user's token, then you can use the token to authorize your self and get access .

    In this page Individual-accounts-in-web-api is explained all what do you need

提交回复
热议问题