0
我使用示例模板創建了一個新的WebAPI項目(VS 2013,.net framework 4.5.1,c#),添加了一個新控制器並在本地計算機上測試了這個項目。在我的電腦中,一切正常(debug \ release)。InvalidOperationException:沒有OWIN身份驗證管理器與請求相關
當發佈此天青託管,我收到此錯誤信息:
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()
我不知道是什麼原因。所以,我Google搜索了它。 解決方案我曾嘗試:
- According to this report,我想添加這個(Microsoft.Owin.Host.SystemWeb)NuGet包,不解決我的問題。
- According to this solution,用戶意見,以改變一些代碼行這樣: Microsoft.AspNet.WebApi.Owin(UseOwinMethod)
我不明白,在那裏我應該把這個代碼行(並替換我現有項目中的代碼行)。
謝謝你的幫助。