ASP.NET Web Api - Startup.cs doesn't exist

后端 未结 5 711
广开言路
广开言路 2021-02-01 12:43

I have an ASP.NET Web Api solution which doesn\'t contain a Startup.cs class. I presume this is because the solution wasn\'t created as an MVC solution.

All the code for

5条回答
  •  遇见更好的自我
    2021-02-01 13:36

    You can add your own startup class, but you need to make sure that Owin is recognizing it. There are several ways to do this , but if you'd like to use a Startup class then you need to use the OwinStartup attribute.

    eg:

    [assembly: OwinStartup(typeof(MyNamespace.MyStartupClass))]
    

提交回复
热议问题