Reputation: 1577
I've deployed my solution to an Azure CloudService using SDK version 2.6. The solution is running fine and now I want to configure some IIS settings from the RoleEntryPoint (like keeping the Threadpool always running).
Whatever I do, it seems that my RoleEntryPoint is never called. I am trying to trace information, I am throwing exceptions, I am even returning "false" in OnStart(). I deploy my package, the Cloudservice instances restart and everything is fine.
This is my simple class:
using System;
using System.Diagnostics;
using System.Linq;
using Elmah;
using Microsoft.Web.Administration;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
using Telerik.Sitefinity.Cloud.WindowsAzure;
namespace SitefinityWebApp
{
public class AzureWebRole : RoleEntryPoint
{
public override void Run()
{
Trace.WriteLine("Entering Run method");
Trace.TraceInformation("Run");
base.Run();
}
public override bool OnStart()
{
return false;
Trace.WriteLine("Entering OnStart method");
Trace.TraceInformation("OnStart");
throw new System.ApplicationException("you are going down!");
return base.OnStart();
}
}
}
This class is in my main WebRole-Assembly. After deploying I tried "Reimaging" and restarting the VM. Both should be unnecessary but I wanted to make sure that the role gets a chance to call the RoleEntryPoint.
Any idea why the code is not called? I understand that returning "false" from the OnStart should have the effect that the role doesn't start at all? Why does the role start?
Upvotes: 4
Views: 2670
Reputation: 31641
Our RoleEntryPoint
was also not starting for the Azure Cloud Service Web Role. To fix this issue - the following steps worked for us:
packages.config
packages.config
and Project References.Microsoft.WindowsAzure.ServiceRuntime
Project Reference has Copy Local = true
@mohamed-abed led us to this solution, we had a version mismatch between the Azure SDK and the unofficial nuget package for Azure Runtime.
The essential rule is that your CCPROJ ProductVersion
should match the Assembly version referenced in your Web Role or the RoleEntryPoint
will not be invoked.
Upvotes: 2