OwinStartup 不触发 [英] OwinStartup not firing

查看:29
本文介绍了OwinStartup 不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我让 OwinStartup 配置代码完美运行,然后它停止工作.不幸的是,我不确定我做了什么才能让它停止工作,而且我真的很难弄清楚.

I had the OwinStartup configuration code working perfectly and then it stopped working. Unfortunately I'm not sure exactly what I did to get it to stop working and am having a really hard time figuring it out.

为了确保我掌握了基础知识,我再次检查以确保我拥有

To make sure I have the basics covered, I doubled checked to make sure the I have the

[assembly:OwinStartup(typeof(WebApplication.Startup))] 

正确分配属性并确保我没有设置为 false 的 owin:AutomaticAppStartup 的 appSetting,因此我将一个设置为 true 以确保安全,因为之前没有任何内容.

attribute assigned properly and made sure that I don't have an appSetting for owin:AutomaticAppStartup that is set to false so I made one set to true to be safe as there was nothing there before.

<add key="owin:AutomaticAppStartup" value="true" />

我也尝试过专门调用 appSetting:

I also tried specifically calling out the appSetting:

<add key="owin:appStartup" value="WebApplication.Startup" />

在它停止工作之前,我将 Microsoft.Owin.Security NuGet 包升级到 2.0.2,所以我尝试将它们恢复到 2.0.1(这很痛苦)但它没有改变任何东西.我在项目上安装了 WebActivator 并使用它来引导其他东西,但我已经在一个新的 WebApplication 模板上测试了它并且它在那里工作,所以我认为这不是罪魁祸首.

Before it stopped working I upgraded the Microsoft.Owin.Security NuGet packages to 2.0.2, so I tried reverting them to 2.0.1 (that was a pain) but it didn't change anything. I have WebActivator installed on the project and am using that to bootstrap other things but I've tested that on a fresh WebApplication template and it works there so I don't think that is the culprit.

我还尝试删除我的 Startup 类并使用 Visual Studio 使用添加新项中的 OWIN 启动类类型添加一个新类,但也没有被调用.接下来我尝试添加第二个 Startup 类,因为我知道如果定义了多个 OwinStartup 属性,它会抛出异常,但它不会在那里抛出任何异常.

I also tried removing my Startup class and using Visual Studio to add a new one using the OWIN Startup Class type in Add New Item and that isn't getting called either. Next I tried adding a second Startup class since I know it will throw an exception if there is more than one OwinStartup attributes defined, but it isn't throwing any exception there.

不知道还能尝试什么.有什么想法吗?

Not sure what else to try. Any thoughts?

更新

事实证明,当我使用 Resharper 删除未使用的引用时,Resharper 删除了对 Microsoft.Owin.Host.SystemWeb 的引用.

Turns out that Resharper removed the reference to Microsoft.Owin.Host.SystemWeb when I used it to remove unused references.

推荐答案

确保你已经在项目中安装了 Microsoft.Owin.Host.SystemWeb 包.IIS 托管应用程序中的启动检测需要此包.有关更多信息,您可以参考 这篇文章.

Make sure you have installed Microsoft.Owin.Host.SystemWeb package in the project. This package is needed for startup detection in IIS hosted applications. For more information you can refer to this article.

这篇关于OwinStartup 不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆