owin - startup.cs文件的作用是什么?

标签 owin asp.net-core

我试图探索一些 ASP.NET-5 应用程序,我在其中找到了 startup.cs 文件。我们在这里设置路由和所有(当然不仅仅针对路由)。我还看到一些演示,其中显示了依赖注入(inject)的使用 here .所以,我正在寻找以下问题的答案:

  1. 为什么这个 startup.cs 是?它有什么作用?
  2. 这个文件有什么用?
  3. 这样做有什么好处?

并且是否有任何好的文档可以详细了解 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/

相关文章:

docker - Docker中的.NET Core 2.0 Identity Server + MVC-在MacOS上构建失败

c# - 从 Entity Framework 类获取默认的 sql 值

c# - 创建为 .Net Auth Cookie 交换自定义 token 的 Owin Auth Provider

c# - 如何为登录用户添加和启用 OWIN 角色?

c# - 尝试在 Plesk Onyx 17.8.11 上托管 ASP.NET 2.2 网站时出错 - HTTP 错误 500.0 - ANCM 进程内处理程序加载失败

ms-access - .NET Core 中的 MS Access 数据库

c# - 将 Asp.Net Core 1 转换为 Core 2 后 Jwt 不工作

asp.net - 使用 asp.net Identity 的 WebAPI2 中的多个 token 生命周期

web-services - Owin TestServer 在测试时多次记录 - 我该如何解决这个问题?

c# - 如何在用户注册期间生成 OWIN 不记名 token