Base solution for your next web application
Open Closed

How to configure .Net Core Web.Host project to target IIS server deployment? #6337


User avatar
0
yefim created

Hi, I use .Net Core/Angular template. As a deployment target - for Debugging and Release - I see only IIS Express and <MyApp>.Web.Host options (both work fine). What has to be done to configure also IIS server as a target ?


11 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can refer to this document, if there is a problem with the welcome feedback.

    https://docs.aspnetzero.com/documents/zero/latest/Step-by-step-angular-publish-to-iis

  • User Avatar
    0
    yefim created

    Hi, I installed all packages and tools and experimented with different publishing modes, had problems to start the .NET Core (apparently in background), analized logs, found sql server login issue and fixed it. Now the logs does not show any erros. However, all requests I try to execute return 404. When I debug using IIS Express or <app>.Web.Host, the URL is http://localhost:21021/swagger/index.html and http://localhost:21021/api/services/app/.... Under IIS, my web page name is "NetZeroMtellService", the same is the name of the folder, and URL I use is: http://localhost/NetZeroMtellService/swagger/index.html or http://localhost/NetZeroMtellService/api/services/app/... I instantiate WebHostBulder as:

    WebHost.CreateDefaultBuilder(args)
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup<Startup>().Build();
    

    What could be an issue?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @yefim

    Have you solved your problem ? If not, are you using merged solution (Angular & Host project in the same solution) ?

  • User Avatar
    0
    yefim created

    Hi, so far I have no luck. I use host project and test deployment using postman and browser

  • User Avatar
    0
    yefim created

    I suspect 2 areas:

    • I have not modifed appsettings.json and appsettings.Staging.json except changing db connectivity string;
    • in https://jakeydocs.readthedocs.io/en/latest/publishing/iis.html#id3 it is said to add the following to <application>.json script:
    • "tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" }, "scripts": { "postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" } I am not sure where thios file is
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, can you share your IIS configuration by screenshot?

    Also, share the browser network panel when visiting http://localhost/NetZeroMtellService/swagger/index.html

  • User Avatar
    0
    yefim created

    Hi, Can you comment on my “appsettings.json”, and “tools” and “scripts” ? 1.While calls to any API return 404, use of http://localhost/NetZeroMtellService/swagger/index.html returns a blank page. 3. My environment is Windows Server 2016 VM x64.

  • User Avatar
    0
    yefim created

    This is my logs from web page start to swagger access attempt:

    DEBUG 2019-01-29 11:23:05,676 [1    ] Abp.Modules.AbpModuleManager             - Loading Abp modules...
    DEBUG 2019-01-29 11:23:05,709 [1    ] Abp.Modules.AbpModuleManager             - Found 15 ABP modules in total.
    DEBUG 2019-01-29 11:23:05,726 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Mtell.Services.Web.Host.Startup.ServicesWebHostModule, Mtell.Services.Web.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,729 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Mtell.Services.ServicesWebCoreModule, Mtell.Services.Web.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,729 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Mtell.Services.ServicesApplicationModule, Mtell.Services.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,739 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Mtell.Services.ServicesCoreModule, Mtell.Services.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,739 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.Zero.AbpZeroCoreModule, Abp.ZeroCore, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,739 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.Zero.AbpZeroCommonModule, Abp.Zero.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,740 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.AbpKernelModule, Abp, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,740 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.AutoMapper.AbpAutoMapperModule, Abp.AutoMapper, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,740 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Mtell.Services.EntityFrameworkCore.ServicesEntityFrameworkModule, Mtell.Services.EntityFrameworkCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,741 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.Zero.EntityFrameworkCore.AbpZeroCoreEntityFrameworkCoreModule, Abp.ZeroCore.EntityFrameworkCore, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,741 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule, Abp.EntityFrameworkCore, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,741 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.EntityFramework.AbpEntityFrameworkCommonModule, Abp.EntityFramework.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,741 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.AspNetCore.AbpAspNetCoreModule, Abp.AspNetCore, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,741 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.Web.AbpWebCommonModule, Abp.Web.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,742 [1    ] Abp.Modules.AbpModuleManager             - Loaded module: Abp.AspNetCore.SignalR.AbpAspNetCoreSignalRModule, Abp.AspNetCore.SignalR, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:05,745 [1    ] Abp.Modules.AbpModuleManager             - 15 modules loaded.
    DEBUG 2019-01-29 11:23:05,811 [1    ] o.Configuration.LanguageManagementConfig - Converted Abp (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource
    DEBUG 2019-01-29 11:23:05,811 [1    ] o.Configuration.LanguageManagementConfig - Converted AbpZero (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource
    DEBUG 2019-01-29 11:23:05,811 [1    ] o.Configuration.LanguageManagementConfig - Converted Services (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource
    DEBUG 2019-01-29 11:23:05,811 [1    ] o.Configuration.LanguageManagementConfig - Converted AbpWeb (Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource) to MultiTenantLocalizationSource
    DEBUG 2019-01-29 11:23:06,072 [1    ] ameworkCore.AbpEntityFrameworkCoreModule - Registering DbContext: Mtell.Services.EntityFrameworkCore.ServicesDbContext, Mtell.Services.EntityFrameworkCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    DEBUG 2019-01-29 11:23:06,458 [1    ] Abp.Localization.LocalizationManager     - Initializing 4 localization sources.
    DEBUG 2019-01-29 11:23:06,539 [1    ] Abp.Localization.LocalizationManager     - Initialized localization source: Abp
    DEBUG 2019-01-29 11:23:06,549 [1    ] Abp.Localization.LocalizationManager     - Initialized localization source: AbpZero
    DEBUG 2019-01-29 11:23:06,555 [1    ] Abp.Localization.LocalizationManager     - Initialized localization source: Services
    DEBUG 2019-01-29 11:23:06,558 [1    ] Abp.Localization.LocalizationManager     - Initialized localization source: AbpWeb
    DEBUG 2019-01-29 11:23:06,589 [1    ] Abp.BackgroundJobs.BackgroundJobManager  - Start background worker: Abp.BackgroundJobs.BackgroundJobManager
    DEBUG 2019-01-29 11:23:06,637 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Found 10 classes define auto mapping attributes
    DEBUG 2019-01-29 11:23:06,637 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.Models.TokenAuth.ExternalLoginProviderInfoModel
    DEBUG 2019-01-29 11:23:06,644 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.Users.Dto.CreateUserDto
    DEBUG 2019-01-29 11:23:06,644 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.Users.Dto.UserDto
    DEBUG 2019-01-29 11:23:06,645 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.Sessions.Dto.TenantLoginInfoDto
    DEBUG 2019-01-29 11:23:06,645 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.Sessions.Dto.UserLoginInfoDto
    DEBUG 2019-01-29 11:23:06,645 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.Roles.Dto.CreateRoleDto
    DEBUG 2019-01-29 11:23:06,645 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.Roles.Dto.PermissionDto
    DEBUG 2019-01-29 11:23:06,645 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.Roles.Dto.RoleDto
    DEBUG 2019-01-29 11:23:06,646 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.MultiTenancy.Dto.CreateTenantDto
    DEBUG 2019-01-29 11:23:06,646 [1    ] Abp.AutoMapper.AbpAutoMapperModule       - Mtell.Services.MultiTenancy.Dto.TenantDto
    INFO  2019-01-29 11:23:10,671 [6    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/index.html  
    INFO  2019-01-29 11:23:11,158 [6    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 491.2699ms 200 text/html
    INFO  2019-01-29 11:23:11,352 [10   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/swagger-ui.css  
    INFO  2019-01-29 11:23:11,357 [10   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 5.2791ms 404 
    INFO  2019-01-29 11:23:11,359 [7    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/swagger-ui-bundle.js  
    INFO  2019-01-29 11:23:11,360 [13   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/swagger-ui-standalone-preset.js  
    INFO  2019-01-29 11:23:11,361 [7    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 1.3049ms 404 
    INFO  2019-01-29 11:23:11,361 [7    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/ui/abp.js  
    INFO  2019-01-29 11:23:11,361 [13   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.5904ms 404 
    INFO  2019-01-29 11:23:11,361 [7    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.6826ms 404 
    INFO  2019-01-29 11:23:11,362 [6    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/ui/abp.swagger.js  
    INFO  2019-01-29 11:23:11,363 [6    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.7301ms 404 
    INFO  2019-01-29 11:23:11,423 [7    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/swagger-ui-standalone-preset.js  
    INFO  2019-01-29 11:23:11,424 [7    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.671ms 404 
    INFO  2019-01-29 11:23:11,458 [6    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/ui/abp.js  
    INFO  2019-01-29 11:23:11,460 [6    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 1.4911ms 404 
    INFO  2019-01-29 11:23:11,466 [6    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/ui/abp.swagger.js  
    INFO  2019-01-29 11:23:11,466 [6    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.7807ms 404 
    INFO  2019-01-29 11:23:11,769 [10   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/favicon-32x32.png  
    INFO  2019-01-29 11:23:11,770 [10   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 1.075ms 404 
    INFO  2019-01-29 11:23:11,783 [11   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost/NetZeroMtellService/swagger/favicon-16x16.png  
    INFO  2019-01-29 11:23:11,784 [11   ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.7594ms 404
    
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, what is your product version ?

    To run Host project on IIS, additional modification to appsetings.json is not required.

  • User Avatar
    0
    yefim created

    4.4

  • User Avatar
    0
    ryancyq created
    Support Team

    are you running Api or angular project as application in IIS?

    also, do share the browser network panel with 404 network requests with us.

    There was a similar issue report previously. See https://github.com/aspnetzero/aspnet-zero-core/issues/1593