title: Multiple constructors accepting all given argument types have been found in type 'System.Collections.Generic.List`1[Portal.Models.FileDataModel]'
body: <p>I'm using ASP.NET Core 3.1 with EF Core and Azure Storage (File Storage). I am using <code>Microsoft.Azure.Storage.File version 11.2.2</code> for the Azure Storage file handling.</p>
  <p>I'm not sure exactly what this error is referencing other than a Dependency Injection (DI) issue?</p>
  <p>Most of the articles or SO articles that I've come across referencing this error message suggest a DI, but when they inject it in <strong>Startup.cs</strong>, they have an Interface to accompany their injection. I do not.</p>
  <p>I'm using a <strong>Razor page</strong> for this view. This code was previously written for an <strong>MVC</strong> view that I'm trying to convert for cohesion. See original post <a href="https://stackoverflow.com/questions/62943592/download-a-file-with-asp-net-core-razor-page">HERE</a>. The project in MVC works without any issues. Should I just give up trying to do this all in Razor pages and use MVC for my entire project or is there an obvious issue I'm missing??</p>
  <p>Here is my setup:</p>
  <pre class="lang-cs prettyprint-override"><code>namespace AzureFileShare.Pages.Files
  {
      public class IndexModel : PageModel
      {
          private readonly IConfiguration _configuration;
  
          public IndexModel(
              IConfiguration configuration)
          {
              _configuration = configuration;
              
          }
          public async Task&lt;IList&lt;FileModel&gt;&gt; OnGetAsync()
          {
              string fileStorageConnection = _configuration.GetValue&lt;string&gt;(&quot;fileStorageConnection&quot;);
              CloudStorageAccount storageAccount = CloudStorageAccount.Parse(fileStorageConnection);
              CloudFileShare share = storageAccount.CreateCloudFileClient().GetShareReference(&quot;payreports&quot;);
              CloudFileDirectory root = share.GetRootDirectoryReference();
              CloudFileDirectory dir = root.GetDirectoryReference(@&quot;E000002/stubs&quot;);
  
              // list all files in the directory
              var fileData =  await list_subDir(dir);
              return fileData;
  
          }
          
          public static async Task&lt;List&lt;FileModel&gt;&gt; list_subDir(CloudFileDirectory fileDirectory)
          {
              var fileData = new List&lt;FileModel&gt;();
             
              FileContinuationToken token = null;
              do
              {
                  FileResultSegment resultSegment = await fileDirectory.ListFilesAndDirectoriesSegmentedAsync(token);
                  foreach (var fileItem in resultSegment.Results)
                  {
                      if (fileItem is CloudFile)
                      {
                          var cloudFile = (CloudFile) fileItem;
                          //get the cloudfile's properties and metadata
                          await cloudFile.FetchAttributesAsync();
  
                          // Add properties to FileDataModel 
                          fileData.Add(new FileModel()
                          {
                              FileName = cloudFile.Name,
                              Size = Math.Round((cloudFile.Properties.Length / 1024f), 2).ToString(),
                              DateModified = DateTime.Parse(cloudFile.Properties.LastModified.ToString()).ToLocalTime().ToString()
                          });
                      }
  
                      if (fileItem is CloudFileDirectory)
                      {
                          var cloudFileDirectory = (CloudFileDirectory)fileItem;
                          await cloudFileDirectory.FetchAttributesAsync();
                          
                          //list files in the directory
                          var result = await list_subDir(cloudFileDirectory);
                          fileData.AddRange(result);
                      }
                      // get the FileContinuationToken to check if we need to stop the loop
                      token = resultSegment.ContinuationToken;
                  }
              } while (token != null);
  
              return fileData.OrderByDescending(o =&gt; Convert.ToDateTime( o.DateModified)).ToList();
              
          }
      }
  }
  </code></pre>
  <p><strong>Model</strong></p>
  <pre class="lang-cs prettyprint-override"><code>    public class FileModel
      {
          public string FileName { get; set; }
          public string Size { get; set; }
          public string DateModified { get; set; }
      }
  </code></pre>
  <p><strong>appsettings.json</strong></p>
  <pre class="lang-cs prettyprint-override"><code>{
    &quot;ConnectionStrings&quot;: {
      &quot;fileStorageConnection&quot;: &quot;DefaultEndpointsProtocol=https;AccountName=navraereports;AccountKey=REMOVEDFORPUBLIC;EndpointSuffix=core.windows.net&quot;
    }
  
  }
  </code></pre>
  <pre><code>@page
  @model List&lt;FileModel&gt;
  
  @{
      ViewData[&quot;Title&quot;] = &quot;Download Pay Stub Copies&quot;;
  }
  
  &lt;h1&gt;Pay Stub Copies&lt;/h1&gt;
  &lt;table class=&quot;table table-bordered&quot;&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;File Name&lt;/th&gt;
              &lt;th&gt;File Size&lt;/th&gt;
              &lt;th&gt;File Date&lt;/th&gt;
              &lt;th&gt;Download&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          @foreach (var data in Model)
          {
              &lt;tr&gt;
                  &lt;td&gt;@data.FileName&lt;/td&gt;
                  &lt;td&gt;@data.Size&lt;/td&gt;
                  &lt;td&gt;@data.DateModified&lt;/td&gt;
                  &lt;td&gt;
                      &lt;a class=&quot;btn btn-primary&quot;
                         href=&quot;/File/DownloadStub?id=@data.FileName&quot;&gt;Download&lt;/a&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          }
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  <p><strong>Stack Trace:</strong></p>
  <pre><code>System.InvalidOperationException: Multiple constructors accepting all given argument types have been found in type 'System.Collections.Generic.List`1[AzureFileShare.FileModel]'. There should only be one applicable constructor.
     at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.TryFindMatchingConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo&amp; matchingConstructor, Nullable`1[]&amp; parameterMap)
     at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo&amp; matchingConstructor, Nullable`1[]&amp; parameterMap)
     at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type instanceType, Type[] argumentTypes)
     at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelActivatorProvider.CreateActivator(CompiledPageActionDescriptor actionDescriptor)
     at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DefaultPageModelFactoryProvider.CreateModelFactory(CompiledPageActionDescriptor descriptor)
     at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvokerProvider.CreateCacheEntry(ActionInvokerProviderContext context, FilterItem[] cachedFilters)
     at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvokerProvider.OnProvidersExecuting(ActionInvokerProviderContext context)
     at Microsoft.AspNetCore.Mvc.Infrastructure.ActionInvokerFactory.CreateInvoker(ActionContext actionContext)
     at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointFactory.&lt;&gt;c__DisplayClass7_0.&lt;CreateRequestDelegate&gt;b__0(HttpContext context)
     at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
  --- End of stack trace from previous location where exception was thrown ---
     at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
     at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
  </code></pre>