[英]Azure Mobile Services - No bootstrapper found
I have a Azure Mobile Services project. 我有一个Azure移动服务项目。 When running locally everything works fine, the Application_Start() method gets called which in turn calls my WebApiConfig.Register() method.
在本地运行时,一切工作正常,将调用Application_Start()方法,然后依次调用我的WebApiConfig.Register()方法。
However, when published to a live Azure Mobile Services server the Application_Start() does not get called along with the WebApiConfig.Register(). 但是,当发布到实时Azure移动服务服务器时,Application_Start()不会与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.
可以通过以下两种方式之一指定引导程序:通过定义名称为“ WebApiConfig”的公共静态类,该类具有名为“ Register”的无公共参数的成员,或者使用“ IBootstrapper”属性来定义具有以下内容的公共类:默认构造函数。
Why is Azure Mobile Services not picking up my BootStrapping WebApiConfig? 为什么Azure移动服务不使用我的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! 非常感谢帮助!
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.
在使用.net后端天蓝色移动服务几周之后,我可能建议您只是在门户中重新启动该服务并重新发布。 I have hit some weird unexplained stuff just like you are and somehow fix like that.
我碰到了一些奇怪的无法解释的东西,就像您一样,并且以某种方式解决了该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.