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 Security | Microsoft Authenticator
Developer technologies | ASP.NET | Other
Developer technologies | C#
Developer technologies | 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.
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 30,206 Reputation points Microsoft External Staff
    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.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.