title: Mapper.Map<Task<IEnumerable<Address>>, Task<IEnumerable<AddressView>>()
body: <p>.NET Framework 4.5.2, .Asp.NET Web API 5.2.3, AutoMapper 5.1.1</p>
  
  <p>I have the following ASP.NET MVC WebApi Action Method on the AddressController. For my test I return only 10 records as you can see in service method below:</p>
  
  <pre><code>[Route("api/Address/GetAllAsync")]
  [HttpGet]
  public async Task&lt;IEnumerable&lt;AddressModel&gt;&gt; GetAllAsync()
  {
      AddressService service = new AddressService(new DataContext());
      Task&lt;IEnumerable&lt;Address&gt;&gt; data = service.GetAllAddressesAsync();
      var addressList = Mapper.Map&lt;Task&lt;IEnumerable&lt;Address&gt;&gt;, Task&lt;IEnumerable&lt;AddressModel&gt;&gt;&gt;(data);
  
      return await addressList;
  }
  </code></pre>
  
  <p>service.GetAllAddressesAsync is</p>
  
  <pre><code>public async Task&lt;IEnumerable&lt;Address&gt;&gt; GetAlladdressesAsync()
  {
      var data = from a in _context.Addresses.Take(10)
                 orderby a.City
                 select a;
  
      return await data.ToListAsync();
  }
  </code></pre>
  
  <p>AutoMapper is configured in Global.asax.cs as:</p>
  
  <pre><code>Mapper.Initialize(cfg =&gt; cfg.CreateMap&lt;Address, AddressModel&gt;());
  Mapper.AssertConfigurationIsValid();
  </code></pre>
  
  <p>I have also tried to configure AutoMapper like</p>
  
  <pre><code>Mapper.Initialize(cfg =&gt; cfg.CreateMap&lt;Task&lt;IEnumerable&lt;Address&gt;&gt;, Task&lt;IEnumerable&lt;AddressModel&gt;&gt;&gt;());
  Mapper.AssertConfigurationIsValid();
  </code></pre>
  
  <p>With the first configuration the solution starts but when calling the GetAllAsync() method from browser the Response body (in F12 Developer Tools / Networking) shows the following error message:</p>
  
  <p>{"message":"An error has occurred.","exceptionMessage":"Missing type map configuration or unsupported mapping.\r\n\r\nMapping types:\r\nTask<code>1 -&gt; Task</code>1\r\nSystem.Threading.Tasks.Task<code>1[[System.Collections.Generic.IEnumerable</code>1[[DataAccess.Address, DataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] -> System.Threading.Tasks.Task<code>1[[System.Collections.Generic.IEnumerable</code>1[[TestAspNetIdentity.Models.AddressModel, TestAspNetIdentity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]","exceptionType":"AutoMapper.AutoMapperMappingException","stackTrace":" </p>
  
  <p>When trying the second configuration of AutoMapper the solution starts but when calling the method the request dies without any Response or exception on client or on server and the browser waits on Response in a indefinite Loop.</p>
  
  <p>How should I configure and use AutoMapper to map <code>Task&lt;IEnumerable&lt;MyTypeA&gt;&gt;</code> to <code>Task&lt;IEnumerable&lt;MyTypeB&gt;&gt;</code>? Do I make some basic Errors with async-task-awayt usage? Does anybody have an example?
  Thank you for your help.</p>
  
  <p>Regards
  Adrian</p>