static void Main() { if (!VerifyConfiguration()) { Console.ReadLine(); return; } // Init. CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ConnectionString); Storage.Init(storageAccount); InputImageModel.Init(storageAccount); ImageProcessJobModel.Init(storageAccount); // App Serviceでは必要なくできる。d:\home参照 // Utils.Storage.DownLoadContents(storageAccount); // example.. // System.IO.Stream stream = Storage.DownloadFileToStream("hoge.jpg"); // ImageProcessor.execute(stream); // // Console.WriteLine("Init queue"); // Init(storageAccount); Console.WriteLine("Waiting queue. run and block.."); JobHostConfiguration config = new JobHostConfiguration(); config.Queues.MaxPollingInterval = TimeSpan.FromMilliseconds(500); JobHost host = new JobHost(config); host.RunAndBlock(); }
public static void Register(HttpConfiguration config) { // Web API configuration and services // Model init CloudStorageAccount storageAccount = CreateStorageAccountFromConnectionString(CloudConfigurationManager.GetSetting("StorageConnectionString")); BlobModel.Init(storageAccount); QueueModel.Init(storageAccount); ImageProcessJobModel.Init(storageAccount); InputImageModel.Init(storageAccount); // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }