title: Routes with different controllers but same action name fails to produce wanted urls
body: <p>I am trying to set up a API for my MVC web app that will have a lot of routes but much of the same part for each one.  Basically a CRUD for each area.  I am also setting it up to be version-able.  I have set up two controllers each with a simple action to get started and receive a conflict right off the bat.  The error I get is </p>
  
  <p>I am after these urls</p>
  
  <ul>
  <li><a href="https://foo.bar/aim/v1/contacts/delete/11111" rel="noreferrer">https://foo.bar/aim/v1/contacts/delete/11111</a></li>
  <li><a href="https://foo.bar/aim/v1/locations/delete/11111" rel="noreferrer">https://foo.bar/aim/v1/locations/delete/11111</a></li>
  <li>and so on</li>
  </ul>
  
  <p>The MVC will let you have a </p>
  
  <ul>
  <li><a href="https://foo.bar/home/index/" rel="noreferrer">https://foo.bar/home/index/</a></li>
  <li><a href="https://foo.bar/contacts/index/" rel="noreferrer">https://foo.bar/contacts/index/</a></li>
  <li>and so on</li>
  </ul>
  
  <p>So I am looking for a away around needlessly naming things like <code>contacts_delete</code> and <code>locations_delete</code> producing URLs like</p>
  
  <ul>
  <li><a href="https://foo.bar/aim/v1/contacts/contacts_delete/11111" rel="noreferrer">https://foo.bar/aim/v1/contacts/contacts_delete/11111</a></li>
  <li><a href="https://foo.bar/aim/v1/locations/locations_delete/11111" rel="noreferrer">https://foo.bar/aim/v1/locations/locations_delete/11111</a></li>
  <li><p>and so on</p>
  
  <p><strong><em>(which is in the observation of the root issue provided in the comments and below anwsers like <code>Route names must be unique. You cannot have two different routes named delete. Use deleteLocation and deleteContact instead.</code>)</em></strong></p></li>
  </ul>
  
  <p>I may as well just do <code>https://foo.bar/aim/v1/contacts_delete/11111</code> but that seems so senseless to me.  If the MVC can do it, i have to believe that there is a way to make this happen.</p>
  
  <p><strong>The error I get is:</strong></p>
  
  <blockquote>
    <p>Attribute routes with the same name 'delete' must have the same template:</p>
    
    <p>Action: 'rest.fais.foo.edu.Controllers.aimContactsController.delete (rest.fais.foo.edu)' - Template: 'aim/v1/contacts/delete/{id}'</p>
    
    <p>Action: 'rest.fais.foo.edu.Controllers.aimLocationsController.delete (rest.fais.foo.edu)' - Template: 'aim/v1/locations/delete/{id}'</p>
  </blockquote>
  
  <p><strong>For the controllers I have set up</strong></p>
  
  <pre><code>[EnableCors("SubDomains")]
  [ResponseCache(NoStore = true, Duration = 0)]
  [Produces("application/json")]
  [Route("aim/v1/contacts/[action]")]
  [ProducesResponseType(typeof(errorJson), 500)]
  public class aimContactsController : Controller
  {
      private readonly IHostingEnvironment _appEnvironment;
      private readonly AimDbContext _aim_context;
      private readonly UserManager&lt;ApplicationUser&gt; _userManager;
  
      public aimContactsController(IHostingEnvironment appEnvironment,
          AimDbContext aim_context,
          UserManager&lt;ApplicationUser&gt; userManager)
      {
          _appEnvironment = appEnvironment;
          _userManager = userManager;
          _aim_context = aim_context;
      }
  
  
  
      [HttpPost("{id}", Name = "delete")]
      public IActionResult delete(string id)
      {
  
          return Json(new
          {
              results = "deleted"
          });
      }
  
  }
  
  
  [EnableCors("SubDomains")]
  [ResponseCache(NoStore = true, Duration = 0)]
  [Produces("application/json")]
  [Route("aim/v1/locations/[action]")]
  [ProducesResponseType(typeof(errorJson), 500)]
  public class aimLocationsController : Controller
  {
      private readonly IHostingEnvironment _appEnvironment;
      private readonly AimDbContext _aim_context;
      private readonly UserManager&lt;ApplicationUser&gt; _userManager;
  
      public aimLocationsController(IHostingEnvironment appEnvironment,
          AimDbContext aim_context,
          UserManager&lt;ApplicationUser&gt; userManager)
      {
          _appEnvironment = appEnvironment;
          _userManager = userManager;
          _aim_context = aim_context;
      }
  
  
  
      [HttpPost("{id}", Name = "delete")]
      public IActionResult delete(string id)
      {
  
          return Json(new
          {
              results = "deleted"
          });
      }
  
  }
  </code></pre>
  
  <p>For the <strong>Startup.cs</strong> I have </p>
  
  <pre><code>    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
      {
          loggerFactory.AddConsole(Configuration.GetSection("Logging"));
          loggerFactory.AddDebug();
          //RolesData.SeedRoles(app.ApplicationServices).Wait();
  
          app.UseApplicationInsightsRequestTelemetry();
  
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
              app.UseDatabaseErrorPage();
              app.UseBrowserLink();
          }
          else
          {
              //app.UseExceptionHandler("/Home/Error");
          }
  
          app.UseIdentity();
          app.UseDefaultFiles();
          app.UseStaticFiles();
  
          //app.UseResponseCompression();
  
          // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715
          app.UseSession();
  
          // custom Authentication Middleware
          app.UseWhen(x =&gt; (x.Request.Path.StartsWithSegments("/aim_write", StringComparison.OrdinalIgnoreCase) || x.Request.Path.StartsWithSegments("/rms", StringComparison.OrdinalIgnoreCase)),
          builder =&gt;
          {
              builder.UseMiddleware&lt;AuthenticationMiddleware&gt;();
          });
  
          // Enable middleware to serve generated Swagger as a JSON endpoint.
          app.UseSwagger();
  
          // Enable middleware to serve swagger-ui (HTML, JS, CSS etc.), specifying the Swagger JSON endpoint.
          app.UseSwaggerUI(c =&gt;
          {
              c.RoutePrefix = "docs";
              //c.SwaggerEndpoint("/docs/v1/wsu_restful.json", "v1.0.0");swagger
              c.SwaggerEndpoint("/swagger/v1/swagger.json", "v1.0.0");
          });
  
  
          app.UseMvc(routes =&gt;
          {
              routes.MapRoute(
                  name: "javascript",
                  template: "javascript/{action}.js",
                  defaults: new { controller = "mainline" });
              routes.MapRoute(
                  name: "default",
                  template: "{controller=Home}/{action=Index}/{id?}");
              routes.MapRoute(
                  name: "AIMApi",
                  template: "aim/v1/{action}/{id?}",
                  defaults: new { controller = "aim" });
              routes.MapRoute(
                  name: "AIMContactsApi",
                  template: "aim/v1/contacts/{action}/{id?}",
                  defaults: new { controller = "aimContactsController" }
              );
              routes.MapRoute(
                  name: "AIMLocationsApi",
                  template: "aim/v1/locations/{action}/{id?}",
                  defaults: new { controller = "aimLocationsController" }
              );
              routes.MapRoute(
                  name: "RMSApi",
                  template: "{controller=rms}/v1/{action}/{id?}");
          });
      }
  }
  </code></pre>
  
  <p>What I can't seem to google out the answer how to work around this.  I want to fix the immediate issue, but any suggests are welcomed.</p>