Reputation: 15887
I have an asp.net 4.5 app deployed to azure. The service plan is Standard (S2) 2 cores
I have a long running task, that needs to be executed in fire-and-forget manner after a get request to an action method.
But even with the following test code:
public ActionResult TestItem()
{
// test method source is below
HostingEnvironment.QueueBackgroundWorkItem(ct => this.Context.TestMethod(););
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
public void TestMethod()
{
using (var conn = _connectionFactory.Create())
{
conn.Open();
conn.Execute("INSERT INTO web.HotelSearchQueue (HSQ_ID) VALUES(@id)", new { @id = Guid.NewGuid() });
}
}
nothing happens. Of course this is working fine on the DEV machine and it is also working when called directly, blocking the request thread.
Any idea what may cause that problem?
Upvotes: 1
Views: 1012
Reputation: 41
I have experienced the same issue. After calling support they advised me to place additional option in Application Settings of Azure App Service "WEBSITE_DYNAMIC_CACHE" with value "0". This is temporary fix and they said that update will be available in future which will allow avoid of using this setting.
Upvotes: 1