gpt4 book ai didi

owin - ASP.NET MVC 5 中的启动类

转载 作者:行者123 更新时间:2023-12-04 00:11:45 26 4
gpt4 key购买 nike

我对 ASP.NET MVC 5 中的 Startup 类感到好奇,当我从 Startup 类中删除程序集属性时,Startup 类中的代码仍在执行中。

using Microsoft.Owin;
using Owin;
using SignalRChat;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

//[assembly: OwinStartup(typeof(SignalRChat.Startup))]
namespace SignalRChat
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
}

谁能告诉我为什么会这样?

谢谢

最佳答案

OWIN Startup Class Detection | The ASP.NET Site :

You connect the startup class with the hosting runtime using one of the these approaches:

  • Naming Convention: Katana looks for a class named Startup in namespace matching the assembly name or the global namespace.

  • OwinStartup Attribute: This is the approach most developers will take to specify the startup class.

  • The appSetting element in the Configuration file


强调我的。您的类(class)因其名称而被使用。

关于owin - ASP.NET MVC 5 中的启动类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33716216/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com