如何使服务器使用startup.cs而不是Global.asax.cs

时间:2015-02-13 14:48:45

标签: c# asp.net-mvc-5 server

我正在尝试在网络上发布应用程序但是服务器搜索Global.asax.cs并删除了该文件并添加了startup.cs。

如何让服务器搜索startup.cs而不是Global.asax.cs,或者解决此问题的最佳方法是什么?

1 个答案:

答案 0 :(得分:1)

您必须从Nuget添加Owin包并使用如下所示的启动类:

using Owin;
using Microsoft.Owin;
[assembly: OwinStartup(typeof(YOURNAMESPACE.Startup))]
namespace YOURNAMESPACE
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            //DO your stuff
        }
    }
}

希望这有帮助