Пример #1
0
        // Please set the following connection strings in app.config for this WebJob to run:
        // AzureWebJobsDashboard and AzureWebJobsStorage
        static void Main()
        {
            _servicesBusConnectionString = AmbientConnectionStringProvider.Instance.GetConnectionString(ConnectionStringNames.ServiceBus);
            _namespaceManager            = NamespaceManager.CreateFromConnectionString(_servicesBusConnectionString);
            InitializeQueue();

            JobHostConfiguration configuration = new JobHostConfiguration
            {
                DashboardConnectionString = "",
                StorageConnectionString   = AmbientConnectionStringProvider.Instance.GetConnectionString(ConnectionStringNames.Storage)
            };
            //configuration.StorageConnectionString = ConfigurationManager.ConnectionStrings[""]

            ServiceBusConfiguration serviceBusConfig = new ServiceBusConfiguration
            {
                ConnectionString = _servicesBusConnectionString
            };

            configuration.UseServiceBus(serviceBusConfig);
            configuration.JobActivator = new AutofacJobActivator(AutofacContainerBuilder.BuildContainer());

            var host = new JobHost(configuration);

            // The following code ensures that the WebJob will be running continuously
            host.RunAndBlock();
        }
Пример #2
0
        private void BuildAutofacContainerAndStartActivityService()
        {
            // INFO: Doing the IoC container building here
            AutofacContainerBuilder builder = new AutofacContainerBuilder();

            this.container = builder.BuildContainer();
        }
Пример #3
0
        private void AutofacConfiguration()
        {
            var config = GlobalConfiguration.Configuration;

            var builder   = new AutofacContainerBuilder();
            var container = builder.BuildContainer();

            config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
        }
Пример #4
0
 protected void Application_Start()
 {
     log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("~/Configs/Log4net.config")));
     AutofacContainerBuilder.BuildContainer();
     using (var dbcontext = new WisdomScenicDbContext("WisdomScenicDbContextWrite"))
     {
         var objectContext     = ((IObjectContextAdapter)dbcontext).ObjectContext;
         var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace);
         mappingCollection.GenerateViews(new List <EdmSchemaError>());
     }
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Пример #5
0
        /// <summary>
        ///     Главная точка входа для приложения.
        /// </summary>
        private static void Main()
        {
            SetConfiguration();
            var container  = AutofacContainerBuilder.BuildContainer();
            var winService = container.Resolve <IWinServiceStatusSender>();

            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new IntelStatusSenderService(winService)
            };
            ServiceBase.Run(ServicesToRun);
        }