1
votes

I have a Azure Mobile Services project. When running locally everything works fine, the Application_Start() method gets called which in turn calls my WebApiConfig.Register() method.

However, when published to a live Azure Mobile Services server the Application_Start() does not get called along with the WebApiConfig.Register().

In the servers log I have the following entry:

No bootstrapper found -- using default bootstrapper. A bootstrapper can be specified in one of two ways: Either by defining a public, static class with name 'WebApiConfig' having a public parameter-less member called 'Register', or using the 'IBootstrapper' attribute to define a public class with a default constructor.

Why is Azure Mobile Services not picking up my BootStrapping WebApiConfig?

public static class WebApiConfig
{
    public static void Register()
    {
        Trace.TraceInformation("Hello from WebApiConfig Register().");


        // Use this class to set configuration options for your mobile service
        ConfigOptions options = new ConfigOptions();

        // Use this class to set WebAPI configuration options
        HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options));


        // To display errors in the browser during development, uncomment the following
        // line. Comment it out again when you deploy your service for production use.
        // config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;


    }
}

public class WebApiApplication : System.Web.HttpApplication
{
    public WebApiApplication()
    {
        Trace.TraceInformation("Hello from WebApiApplication ctor!");
    }

    protected void Application_Start()
    {
        Trace.TraceInformation("Hello from Application_Start()");


        //RouteConfig.RegisterRoutes(RouteTable.Routes);
        WebApiConfig.Register();

        var dataContext = new DataContext();
        dataContext.Database.Initialize(false);
    }
}

Help is much appreciated!

1
I have the same issue, did you find a solution in the end? - user1719776
Hi Tim, I can't actually remember if/how we resolved this. I've trailed through our source control to find any fixes but cant see anything that stands out. Did you manage to work out what the problem was? Really sorry for such a late reply! - Daniel
Hi Daniel, no worries. I can't remember specifically. I think it may have been a Nuget package that was updated too far for Azure hosting to handle. If anyone sees this issue, please check the versions of all your Nuget packages and check the Azure hosting can handle them. - user1719776

1 Answers

0
votes

That is bizarre... It really looks like you got it right. After working with .net backend azure mobile service for few weeks, I might suggest just maybe restart the service in portal and republish. I have hit some weird unexplained stuff just like you are and somehow fix like that.