我试图探索一些 ASP.NET-5 应用程序,我在其中找到了 startup.cs
文件。我们在这里设置路由和所有(当然不仅仅针对路由)。我还看到一些演示,其中显示了依赖注入(inject)的使用 here .所以,我正在寻找以下问题的答案:
- 为什么这个
startup.cs
是?它有什么作用? - 这个文件有什么用?
- 这样做有什么好处?
并且是否有任何好的文档可以详细了解 startup.cs
的使用。如果我们将类名“Startup”更改为其他名称,为什么应用程序无法运行?
我确实对 OWIN 和管道有非常初步的了解。请帮助我找到这些答案。
最佳答案
只是在这里重复它在 Getting started with vNext 中所说的内容
By default, the vNext hosting environment expects to find a startup class named Startup. This class must contain a Configure method that takes an IBuilder parameter, and you configure the HTTP pipeline inside this Configure method. The empty project creates the class with nothing in the Configure method.
我建议你看看 vNext Moving Parts由 Louis Dejardin 撰写,因为它更多地解释了 OWIN 管道和 vNext。
抱歉没有帮到您!
关于owin - startup.cs文件的作用是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25055471/