Current site lost in async context in multiple site EPiServer configuration

Configure environment

  1. Create an Alloy Mvc site using extension v8.1.0.75 [Creates a new project with .NET Framework 4.5.1] (or clone a github repository)
  2. %windir%\system32\drivers\etc\hosts file contains

127.0.0.1 local.alloy-and-async.com local.alloy-and-async.no local.alloy-and-async.dk edit.alloy-and-async.com edit.alloy-and-async.no edit.alloy-and-async.dk

  1. IIS site configured to look at .\Alloy.AndAsync folder (with bindings configured to accept requests from all the hostnames listed in the point 1.)
  2. IIS Application Pool configured to use NET Framework 4.0 and Integrated Pipeline
  3. SQL Server Express 2012 instance named '.\SQL_2012' installed (*)
  4. Everyone has write access to the .\Alloy.AndAsync\App_Data folder
  5. Valid EPiServer 7 license is available at C:\EPiServer\cms75\License.config

(*) - for different instance names connection string config should be changed appropriately

Steps to Reproduce

  1. Create page type Alloy.AndAsync.Models.Pages.TestArticlePage

![page type](/screenshots/01. Page Type.png)

  1. Create view model Alloy.AndAsync.Models.ViewModels.TestArticlePageViewModel

![view model](/screenshots/02. View Model.png)

  1. Create view ~/Views/TestArticlePage/Index

![view](/screenshots/03. Page View.png)

  1. Create partial view ~/Views/TestArticlePage/AsyncAction

![partial view](/screenshots/04. Partial View.png)

  1. Create controller

![](/screenshots/05. Controller.png)

  1. Copy Rename "Start" page to "Start.com", copy it and rename a copy root to "Start.no"

![](/screenshots/06. Start.com, Start.no.png)

  1. Configure .com site

![](/screenshots/07. .com site.png)

  1. Configure .no site

![](/screenshots/08. .no site.png)

  1. Check sites configuration

![](/screenshots/09. sites configuration.png)

  1. Create test pages

![](/screenshots/10. test pages created.png)

  1. Open /local-async-issue/

![](/screenshots/11. local-async-issue.png)

  1. Open /global-async-issue/

![](/screenshots/12. global-async-issue.png)

Expected Result

SiteDefinition.Current is pointing to a "alloy-and-async.com" site

Actual Result

SiteDefinition.Current is SiteDefinition.Empty inside async action

![](/screenshots/13. bug.png)