protected override System.ServiceModel.ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
    {
        var host = base.CreateServiceHost(serviceType, baseAddresses);

        host.Description.Behaviors.Add(ServiceConfig.ServiceMetadataBehavior);
        ServiceConfig.Configure((ServiceDebugBehavior)host.Description.Behaviors[typeof(ServiceDebugBehavior)]);
        return(host);
    }
Exemplo n.º 2
0
        /// <summary>
        /// Specifies how the ASP.NET application will respond to individual HTTP request.
        /// </summary>
        /// <param name="app">Instance of <see cref="IAppBuilder"/>.</param>
        public void Configuration(IAppBuilder app)
        {
            var corsOptions = CorsConfig.ConfigureCors(ConfigurationManager.AppSettings["cors"]);

            app.UseCors(corsOptions);

            var configuration = new HttpConfiguration();

            FormatterConfig.Configure(configuration);
            RouteConfig.Configure(configuration);
            ServiceConfig.Configure(configuration);

            app.UseWebApi(configuration);
        }
Exemplo n.º 3
0
        public async Task RunAsync()
        {
            var services = new ServiceCollection();                              // Create a new instance of a service collection

            ServiceConfig.Configure(services, Configuration);                    // Add services to the collection (ServiceConfig.cs)

            var provider = services.BuildServiceProvider();                      // Build the service provider.

            provider.GetRequiredService <CommandHandler>();                      // Start the command handler service
            provider.GetRequiredService <EventHandler>();                        // Start the event handler service

            await DiscordConfiguration.ConfigureAndRun(provider, Configuration); //Configs and starts the discord client

            await Task.Delay(-1);                                                // Keep alive
        }
Exemplo n.º 4
0
        /// <summary>
        /// Specifies how the ASP.NET application will respond to individual HTTP request.
        /// </summary>
        /// <param name="app">Instance of <see cref="IAppBuilder"/>.</param>
        public void Configuration(IAppBuilder app)
        {
            CorsConfig.ConfigureCors(ConfigurationManager.AppSettings["cors"]);
            app.UseCors(CorsConfig.Options);

            var configuration = new HttpConfiguration();

            AutofacConfig.Configure(configuration);
            app.UseAutofacMiddleware(AutofacConfig.Container);

            FormatterConfig.Configure(configuration);
            RouteConfig.Configure(configuration);
            ServiceConfig.Configure(configuration);

            app.UseWebApi(configuration);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Specifies how the ASP.NET application will respond to individual HTTP request.
        /// </summary>
        /// <param name="app">Instance of <see cref="IAppBuilder"/>.</param>
        public void Configuration(IAppBuilder app)
        {
            LogConfig.Configure();

            app.UseRequestLogging();

            CorsConfig.ConfigureCors(ConfigurationManager.AppSettings["cors"]);
            app.UseCors(CorsConfig.Options);

            HttpConfiguration configuration = new HttpConfiguration();

            FormatterConfig.Configure(configuration);
            RouteConfig.Configure(configuration);
            ServiceConfig.Configure(configuration);
            SwaggerConfig.Configure(configuration);

            app.UseWebApi(configuration);
            MappingProfile map = new MappingProfile();

            map.Iniciar();
        }
        /// <summary>
        /// Specifies how the ASP.NET application will respond to individual HTTP request.
        /// </summary>
        /// <param name="app">Instance of <see cref="IAppBuilder"/>.</param>
        public void Configuration(IAppBuilder app)
        {
            CorsConfig.ConfigureCors(ConfigurationManager.AppSettings["cors"]);
            app.UseCors(CorsConfig.Options);

            var configuration = new HttpConfiguration();

            AutofacConfig.Configure(configuration);
            app.UseAutofacMiddleware(AutofacConfig.Container);

            FormatterConfig.Configure(configuration);
            RouteConfig.Configure(configuration);
            ServiceConfig.Configure(configuration);
            SwaggerConfig.Configure(configuration);

            app.Use((context, next) =>
            {
                context.Response.Headers.Remove("Server");
                return(next.Invoke());
            });

            app.UseWebApi(configuration);
        }
Exemplo n.º 7
0
 public static void Main(string[] args)
 {
     // Configure service
     ServiceConfig.Configure();
 }
Exemplo n.º 8
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     ServiceConfig.Configure(services, Configuration, SigningKey);
 }