title: .Net Api doesn't recognize my Controllers
body: <p>Guys i have a simple backend codes and i just wanted to integrate swagger ui but it only recognizes 3 Controller from 6 and 3 schema from 7 but when i try to make get request with postman it gives http 404 error. What did i do wrong?
  I'm using Win11 and .net 5 with Visual Studio 2019.</p>
  <p>startup.cs</p>
  <pre><code>public void ConfigureServices(IServiceCollection services)
      {
  
          services.AddControllers();
          services.AddSwaggerGen(c =&gt;
          {
              c.SwaggerDoc(&quot;v1&quot;, new OpenApiInfo { Title = &quot;SwaggerApi&quot;, Version = &quot;v1&quot; });
          });
          services.AddCors();
          services.AddHttpContextAccessor();
          services.AddSwaggerGen();
  
          services.AddDependencyResolvers(new ICoreModule[] {
              new CoreModule()
          });
      }
      
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
  
  
          app.UseCors(builder =&gt; builder.WithOrigins(&quot;http://localhost:5000&quot;).AllowAnyHeader());
  
          app.UseHttpsRedirection();
  
          app.UseWebSockets();
  
          app.UseRouting();
  
          app.UseAuthentication();
  
          app.UseStaticFiles();
  
          app.UseAuthorization();
  
          app.UseEndpoints(endpoints =&gt;
          {
              endpoints.MapControllers();
          });
  
          app.UseSwagger();
  
          app.UseSwaggerUI(c =&gt;
          {
              c.SwaggerEndpoint(&quot;/swagger/v1/swagger.json&quot;, &quot;Sample API&quot;);
          });
      
  </code></pre>
  <p>program.cs</p>
  <pre><code>public static void Main(string[] args)
      {
          CreateHostBuilder(args).Build().Run();
      }
  
      public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
          Host.CreateDefaultBuilder(args)
              .UseServiceProviderFactory(new AutofacServiceProviderFactory())
              .ConfigureContainer&lt;ContainerBuilder&gt;(builder =&gt;
              {
                  builder.RegisterModule(new AutofacBusinessModule());
              })
              .ConfigureWebHostDefaults(webBuilder =&gt;
              {
                  webBuilder.UseStartup&lt;Startup&gt;();
              });
  </code></pre>
  <p>Edit: i didn't place my controllers</p>
  <p>this is recognized controller sample
  usersController.cs</p>
  <pre><code>[Route(&quot;api/[controller]&quot;)]
  [ApiController]
  public class UsersController : ControllerBase
  {
      private IUserService _userService;
  
      public UsersController(IUserService userService)
      {
          _userService = userService;
      }
  
  
      [HttpGet(&quot;getall&quot;)]
      public IActionResult Get()
      {
  
          var result = _userService.GetAll();
          if (result.Success)
          {
              return Ok(result.Data);
          }
          return BadRequest(result.Message);
  
      }
  
      [HttpGet(&quot;getbyid&quot;)]
      public IActionResult Get(int id)
      {
          var result = _userService.GetById(id);
          if (result.Success)
          {
              return Ok(result);
          }
          return BadRequest(result.Message);
      }
  
      
  
  
  
  
      [HttpPost(&quot;add&quot;)]
      public IActionResult PostAdd(User user)
      {
          var result = _userService.Add(user);
          if (result.Success)
          {
              return Ok(result.Message);
          }
          return BadRequest(result.Message);
  
  
      }
  
  
      [HttpPost(&quot;update&quot;)]
      public IActionResult PostUpdate(User user)
      {
          var result = _userService.Update(user);
          if (result.Success)
          {
              return Ok(result);
          }
          return BadRequest(result.Message);
  
  
      }
  
  
      [HttpPost(&quot;delete&quot;)]
      public IActionResult PostDelete(User user)
      {
          var result = _userService.Delete(user);
          if (result.Success)
          {
              return Ok(result);
          }
          return BadRequest(result.Message);
  
  
      }
  }
  </code></pre>
  <p>this is not recognized sample</p>
  <p>systemStavesController.cs</p>
  <pre><code>[Route(&quot;api/[controller]&quot;)]
  [ApiController]
  public class SystemStavesController : ControllerBase
  {
      private ISystemStaffService _staffService;
  
      public SystemStavesController(ISystemStaffService staffService)
      {
          _staffService = staffService;
      }
      
      [HttpGet(&quot;getall&quot;)]
      IActionResult GetAll()
      {
          var result = _staffService.GetAll();
          if (result.Success)
          {
              return Ok(result.Data);
          }
  
          return BadRequest(result.Message);
      }
  
      [HttpGet(&quot;getbyid&quot;)]
      IActionResult GetById(int id)
      {
          var result = _staffService.GetById(id);
          if (result.Success)
          {
              return Ok(result.Data);
          }
  
          return BadRequest(result.Message);
      }
  
      [HttpPost(&quot;add&quot;)]
      IActionResult Add(SystemStaff staff)
      {
          var result = _staffService.Add(staff);
          if (result.Success)
          {
              return Ok(result.Message);
          }
  
          return BadRequest(result.Message);
      }
  
      [HttpPost(&quot;delete&quot;)]
      IActionResult Delete(SystemStaff staff)
      {
          var result = _staffService.Delete(staff);
          if (result.Success)
          {
              return Ok(result.Message);
          }
  
          return BadRequest(result.Message);
      }
  
  
      [HttpPost(&quot;update&quot;)]
      IActionResult Update(SystemStaff staff)
      {
          var result = _staffService.Update(staff);
          if (result.Success)
          {
              return Ok(result.Message);
          }
  
          return BadRequest(result.Message);
      }
  }
  </code></pre>