【发布时间】:2015-04-03 16:51:13
【问题描述】:
我使用示例模板创建了一个新的 WebAPI 项目(VS 2013,.net framework 4.5.1,c#),添加了一个新控制器并在我的本地计算机上进行了测试。在我的电脑中,一切正常(调试\发布)。
将其发布到 Azure 托管时,我收到以下错误消息:
ExceptionMessage=No OWIN authentication manager is associated with the request.
ExceptionType=System.InvalidOperationException
Message=An error has occurred.
StackTrace= at System.Web.Http.Owin.PassiveAuthenticationMessageHandler.SuppressDefaultAuthenticationChallenges(HttpRequestMessage request)
at System.Web.Http.Owin.PassiveAuthenticationMessageHandler.<SendAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()
我不知道是什么原因。所以,我用谷歌搜索了它。 我尝试过的解决方案:
- According to this report,我尝试添加这个 (Microsoft.Owin.Host.SystemWeb) nuget 包,但没有解决我的问题。
- According to this solution,用户建议将一些代码行更改为: Microsoft.AspNet.WebApi.Owin(UseOwinMethod)
我不明白,我应该在哪里放置此代码行(并替换我现有项目中的哪个代码行)。
感谢您的帮助。
【问题讨论】:
标签: c# asp.net azure asp.net-web-api asp.net-web-api2