Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosting IIS Server? #196

Open
rafiqcse opened this issue Feb 8, 2022 · 1 comment
Open

Hosting IIS Server? #196

rafiqcse opened this issue Feb 8, 2022 · 1 comment

Comments

@rafiqcse
Copy link

rafiqcse commented Feb 8, 2022

Can you help me, how to deploy and hosting to IIS server this project?
Please share detail steps for hosting so that we can login to main page.
This project is working perfectly in development mode, I can debug everything,
and also I can host client part.
But when login to access main page menu then server side through the following error.
Failed to load resource: net::ERR_CONNECTION_REFUSED
Please help me.

@rafiqcse
Copy link
Author

rafiqcse commented Mar 9, 2022

At last I succeed to deploy the project to IIS following below instruction

  1. Install .net hosting bundle, urlrewrite2, httpPlatformHandler_amd64.msi, WebPlatformInstaller_x64_en-US.msi

  2. hosts file location C:\Windows\System32\drivers\etc
    -127.0.0.1 nucleus.com

  3. Adding a website for Vuejs client project to iis
    –In this case hosts file name nucleus.com should same host name in iis.

  4. Adding a web application under client to iis as named api

  5. Please go to binding section after selecting client website in iis
    -Adding another binding whose type https and port 44323 (port may change)

  6. Please select api in IIS and double click to SSLSettings
    -Select Require SSL and Accept then apply changes.

  7. Please add named “api” as per server name in IIS to the url in appsettings.Production.json, launchSettings.json, .env.Production, appSettings.json

  8. Please change startup class in server project as follows

    private readonly IConfiguration _configuration;
    public Startup(IConfiguration configuration)
    {
        _configuration = configuration;
    }
    public void ConfigureServices(IServiceCollection services)
    {
        services.ConfigureDbContext(_configuration);
        services.ConfigureAuthentication();
        services.ConfigureJwtTokenAuth(_configuration);
        services.ConfigureCors(_configuration);
        services.ConfigureDependencyInjection();
        services.ConfigureNucleusApplication();
        services.ConfigureSmtp(_configuration);
    
        services.AddControllers(setup =>
        {
            setup.Filters.AddService<UnitOfWorkActionFilter>();
        }).AddNewtonsoftJson();
    
        services.AddSwaggerGen(options =>
        {
            options.SwaggerDoc("v1", new OpenApiInfo { Title = "Nucleus API", Version = "v1" });
            options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
            {
                Description = "Standard Authorization header using the Bearer scheme. Example: \"bearer {token}\"",
                In = ParameterLocation.Header,
                Name = "Authorization",
                Type = SecuritySchemeType.ApiKey
            });
    
            options.OperationFilter<SecurityRequirementsOperationFilter>();
        });
        services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
    }
    
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment() || env.IsProduction())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseHsts();
        }
        app.UseSwagger();
        app.UseSwaggerUI(c =>
        {
            c.SwaggerEndpoint("/swagger/v1/swagger.json", "Nucleus API V1");
        });
    
        app.UseCors(_configuration["App:CorsOriginPolicyName"]);
        app.UseHttpsRedirection();
        app.UseRouting();
        app.UseAuthentication();
        app.UseAuthorization();
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllers();
        });
    }
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant