0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ASP.NETでエラー「No OWIN authentication manager is associated with the request.」

Posted at

No OWIN authentication manager is associated with the request.

WebAPIでアクセスすると「OWIN認証マネージャーは要求に関連付けられていません。」というエラーが出る。

原因

Microsoft.Owin.Host.SystemWebパッケージが足りていません。
これがないとOwinの認証機能(ASP.NET Identitiy)が動きませんでした。
(プロジェクトをMVCで作成するとき、認証ありにすると、デフォルトでインストールされていた気がしますが、今回は空のWebAPIから始めた)

これ、インストール忘れでもコンパイルエラーなどが出ず、実行時エラーでしか気づけません。
移植(コピペ)で作成しているときに忘れがちです…

対応

「Microsoft.Owin.Host.SystemWeb」パッケージをインストールします。

ソリューションを右クリック>ソリューションのNuGetパッケージの管理
image.png

「Microsoft.Owin.Host.SystemWeb」で検索してインストール対象のプロジェクトを選択し、右側にある「インストール」ボタンをクリック。
image.png

正常にインストールされたら完了です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?