Nandish Hosmane
Nandish Hosmane

Reputation: 107

Web API 2 returns 401 when hosted on IIS and return 200 when set authentication to anonymous

I have a WebApi project , which returns some data , this works fine when we query through the URL , but returns 401 when i invoke it from my console app. this project has been hosted in IIS 8 and i need this to run under windows authentication. If i set it to anonymous authentication then works fine, but gives error to windows auth mode. Thanks in advance.

Upvotes: 0

Views: 1164

Answers (2)

Jose Francis
Jose Francis

Reputation: 960

Check this out(it has info on using windows authentication with web API):

https://www.codeproject.com/tips/996401/authenticate-webapis-with-basic-and-windows-authen

Upvotes: 1

Rahul
Rahul

Reputation: 77926

Check HTTP Status Codes RFC ...401 stands for Unauthorized Access means while invoking from your console app you are not passing the Authorization header in your API request.

Upvotes: 3

Related Questions