Exemple #1
0
        // This function will get triggered/executed when a new message is written
        // on an Azure Queue called queue.
        public static void ProcessQueueMessage([QueueTrigger("modernsitesazurewebjob")] string message, TextWriter log)
        {
            var currentPath = Environment.GetEnvironmentVariable("WEBROOT_PATH");

#if DEBUG
            if (String.IsNullOrEmpty(currentPath))
            {
                currentPath = AppDomain.CurrentDomain.BaseDirectory;
                if (currentPath.ToLower().Contains("\\bin\\debug\\"))
                {
                    currentPath = currentPath.Substring(0, currentPath.Length - 11);
                }
            }
#endif

            ModernSitesHelper.CreateModernSite(message,
                                               currentPath,
                                               (s) => { log.WriteLine(s); },
                                               (s) => { log.WriteLine(s); });
        }
Exemple #2
0
        public static void Run([QueueTrigger("modernsitesazurefunction", Connection = "AzureWebJobsStorage")] string message, TraceWriter log)
        {
            var currentPath = Environment.GetEnvironmentVariable("HOME");

#if DEBUG
            if (String.IsNullOrEmpty(currentPath))
            {
                currentPath = AppDomain.CurrentDomain.BaseDirectory;
                if (currentPath.ToLower().Contains("\\bin\\debug\\"))
                {
                    currentPath = currentPath.Substring(0, currentPath.Length - 11);
                }
            }
#endif

            ModernSitesHelper.CreateModernSite(message,
                                               currentPath,
                                               (s) => { log.Info(s); },
                                               (s) => { log.Error(s); });
        }