【发布时间】:2014-10-24 17:31:55
【问题描述】:
我正在使用表单身份验证保护 WebAPI,即使用 Breezecontroller 当我尝试调用 WebAPi 方法时,我得到了以下错误。
状态:404 状态文本:“未找到” 消息:“元数据查询失败:'';,未找到匹配的 Http 资源...
我的问题是为什么我没有返回 "UnAuthorized error(401)" ? 元数据也用 [Authorize] 修饰。
似乎 FormsAuthentication 的重定向出现了问题。 它正在重定向到 Login(has AllowAnonymous) WebApi 方法并报告它找不到,即使我有。我也将Authrozie应用于方法而不是控制器。确切的错误是
{"$id":"1","$type":"System.Web.Http.HttpError,System.Web.Http","Message":"NoHTTPresourcewasfoundthatmatchestherequestURI'http://localhost:40678/api/Country/Login?ReturnUrl=/api/Country/Metadata'.","MessageDetail":"Noactionwasfoundonthecontroller'Country'thatmatchestherequest."}
【问题讨论】:
标签: breeze