title: Can't call API controllers from referenced library on module
body: <p>I created these web projects</p>
  <ul>
  <li>Orchard CMS</li>
  <li>Module</li>
  <li>Reusable API</li>
  </ul>
  <p>Module references Reusable API, and it works fine on it's own</p>
  <p>Added Module into CMS and enabled it</p>
  <p>The problem is, it can't find the controllers on Reusable API from the CMS</p>
  <hr>
  <p>Details:</p>
  <p><a href="https://i.stack.imgur.com/yMYEj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yMYEj.png" alt="enter image description here" /></a></p>
  <p>CMS Startup.cs</p>
  <pre class="lang-cs prettyprint-override"><code>  public class Startup
      {
          // This method gets called by the runtime. Use this method to add services to the container.
          // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddOrchardCms();
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
            
               app.UseRouting();
              app.UseOrchardCore();
  
          }
      }
  </code></pre>
  <p>Module Startup.cs</p>
  <pre class="lang-cs prettyprint-override"><code>    public class Startup
      {
          // This method gets called by the runtime. Use this method to add services to the container.
          // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddControllers();
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
  
              app.UseRouting();
  
              app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapControllers();
              });
          }
      }
  </code></pre>
  <p>Reusable API Startup.cs</p>
  <pre class="lang-cs prettyprint-override"><code>   public class Startup
      {
          // This method gets called by the runtime. Use this method to add services to the container.
          // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddControllers();
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
  
              app.UseRouting();
  
              app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapControllers();
              });
          }
      }
  </code></pre>
  <p>ReusableAPI/Controllers/TestController.cs</p>
  <pre class="lang-cs prettyprint-override"><code>    [Route(&quot;api/[controller]&quot;)]
      [ApiController]
      [IgnoreAntiforgeryToken]
      public class TestController:ControllerBase
      {
          [HttpGet]
          public ActionResult Test()
          {
              return Ok(&quot;test&quot;);
          }
      }
  </code></pre>
  <p>If I run Module, I can call the API controller Test method with no problems<br />
  But, if I run the CMS, I can't call the API controller Test method, it gives me a 404 not found instead.</p>
  <p><strong>However</strong> - If I add controllers support on CMS/Startup.cs, the Reusable API works!</p>
  <pre class="lang-cs prettyprint-override"><code>    public class Startup
      {
          // This method gets called by the runtime. Use this method to add services to the container.
          // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddControllers();
              services.AddOrchardCms();
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
  
              app.UseRouting();
              app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapControllers();
              });
              app.UseOrchardCore();
          }
      }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/EHk11.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EHk11.png" alt="enter image description here" /></a></p>
  <p><strong>But</strong> now I can't access the admin page<br />
  <a href="https://i.stack.imgur.com/TU1BG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TU1BG.png" alt="enter image description here" /></a></p>
  <p>How can I fix this?</p>