我有一个ASP.NET Web Api解决方案,其中不包含Startup.cs类。我认为这是因为该解决方案不是作为MVC解决方案创建的。
所有启动代码都在Global.asax.cs文件中定义,如下所示。
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
不过,现在我希望能够支持OAuth,并且我找到的所有文档都是基于具有以下类的Startup.cs
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
如果我在我的解决方案中添加这个新类,解决方案还会继续工作吗?
这会与Global.asax.cs类产生任何冲突吗?
编辑:在我添加了Startup.cs类之后,我无法触发其中添加的断点...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(MyGame.Startup))]
namespace MyGame
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
有什么想法吗?
[assembly: OwinStartup(typeof(AuthorizationServer.Startup))]
。 - Curiousdev