示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton <IConfiguration>(Configuration);

            try
            {
                throw new Exception("Random exception");
                _Scheduler = Scheduling.Create().Result;
                services.AddSingleton <IScheduler>(_Scheduler);
            }
            catch (Exception ex)
            {
                Log.Logger.Error(ex, "Failed to startup scheduling.");
            }

            services.AddSingleton <FacebookOptions>(new FacebookOptions()
            {
                AppSecret             = "6259b3e435b7971f92f2af0dc38792ca",
                AppToken              = "EAAPjbVpgI9cBALWZBRS0xVkxhTZCNZBBR3eS388MU5zrmx9uQiLPCeohEeo6VglNzKDbJHHmMbW0LELGvnBLJTbefmzd4DREz1SF4QOcqnoofk8FPzCELV5Iop8ZACR5G5L7P9LzrG4nGe9PEx3KYnwZBBV5OZBhPiqS1tlRZA3tAZDZD",
                ShouldVerifySignature = false,
                VerifyToken           = "my_verify_token"
            });
            services.AddSingleton <DialogManager>();

            //string eventhubHostFormat = "amqps://{0}:{1}@{2}.servicebus.windows.net";
            //var address = string.Format(eventhubHostFormat, "RootManageSharedAccessKey", Uri.EscapeUriString("i4O7XCN0bK7wjbyQJo1H30ZfTb0RVPejysh1pmMu/Zw="), "healthcoach");
            //services.AddSingleton<IEventingClient>(new AzureEventingClient(address));

            Azure.RegisterServices(Configuration, services).Wait();

            // Add framework services.
            services.AddMvc();
        }