configuration method not executing in startup.cs

N 1 Reputation point
2023-07-18T03:39:54.4633333+00:00

I have created new mvc project and added startup.cs class with one method.

but debug is not coming in this method directly debug is going on homecontroller

but it should come first startup class. why my debug is not coming in configuration method.

public class Startup
    {
        public void Configuration()
        {
            
        }
    }
Microsoft Authenticator
Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
5,619 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,303 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,360 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 26,121 Reputation points Microsoft Vendor
    2023-07-18T06:03:01.8266667+00:00

    Hi @N,

    Startup.cs is a part of the OWIN authorization package.You need to install the Microsoft.Owin.Host.SystemWeb package from NuGet.

    From the Tools menu, select NuGet Package Manager, then select Package Manager Console. In the Package Manager Console window, type the following command:

    install-package Microsoft.Owin.Host.SystemWeb –Pre

    Then add the following code:

     public class Startup
        {
            public void Configuration(IAppBuilder app)
            {
               
    
            }
        }
    

    Best regards,
    ASP.NET MVC Startup

    Add a Startup Class

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.