我有不通过本地 IIS 运行的本地 Web API 项目。要运行该项目,我在 Visual Studio 2013 中使用 F5。
使用 Fiddler,我不断得到:
HTTP/1.1 401 Unauthorized
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom 88 401 HTTP localhost:52787 /api/values 6,180 private text/html; charset=utf-8 fiddler:10724
我知道我应该得到 200,但我没有。我应该在哪里检查我做错了什么?
这是来自浏览器的屏幕截图。当我回到 Fiddler 查看结果时,我得到了这个,我只需输入
http://localhost:52787/api/helloapi
进入 URL(在浏览器中)并按 Enter:这是我通过 Fiddler 手动编写 GET 时得到的结果:
我已选中自动身份验证选项。
最佳答案
当您说“使用 Fiddler”时,您到底是什么意思?
如果您使用 Fiddler 的 手动编写请求作曲 ,或者添加一个 Authorization
标题自己,或单击 Composer 的 选项 选项卡并检查 Automatically Authenticate
盒子。
关于authentication - Fiddler HTTP/1.1 401 未经授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26350033/