简体   繁体   English

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

[英]How to make the server use the startup.cs instead of Global.asax.cs

I am trying to publish an app in the web but the server searches for Global.asax.cs and I deleted that file and added startup.cs instead. 我试图在网络上发布一个应用程序,但服务器搜索Global.asax.cs,然后删除了该文件并添加了startup.cs。

How can I make the server search for startup.cs instead of Global.asax.cs, or what is the best approach to fix this issue ? 如何使服务器搜索startup.cs而不是Global.asax.cs,或者什么是解决此问题的最佳方法?

You have to add the Owin package from Nuget and use a startup class looks like this: 您必须从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
        }
    }
}

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM