Open Closed

How to Deploy to IIS on Windows Server 2016 #2730


0
piseth created
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

I am trying to deploy my abp applications on IIS. On IIS Manager, when I browse it as http://mywebsite.com or https://mywebsite.com:44346 , i get the following errors:

**1/ if I input Host Name in "Sites Bindings" HTTP Error 500.30 - ASP.NET Core app failed to start

2/ I do not input any host name => http://10.x.x.202/ The Website cannot display the page Most likely causes:

  • The website is under maintenance
  • The Website has a programming error.**

Please provide your email address, then i will send you the log.txt file to you


*2022-03-12 16:07:31.327 +03:00 [INF] Request starting HTTP/1.1 GET http://10.21.161.202/ - - 2022-03-12 16:07:31.651 +03:00 [ERR] GetHealthReport threw an exception when trying to get report from /health-status configured with name Asiacell Health Status. System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.


AUDIT LOG: [500: GET ] /Error

  • UserName - UserId : -
  • ClientIpAddress : 10.21.161.202
  • ExecutionDuration : 16
  • Actions:
    • Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (2 ms.) {}
  • Exceptions:
    • Could not find file '/libs/abp/core/abp.css' Volo.Abp.AbpException: Could not find file '/libs/abp/core/abp.css' at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.GetFileInfo(IBundlerContext context, String file) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.GetAndMinifyFileContent(IBundlerContext context, String fileName) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.GetFileContentConsideringMinification(IBundlerContext context, String fileName) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundlerBase.Bundle(IBundlerContext context) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleManager.<>c__DisplayClass16_0.<GetBundleFilesAsync>b__0() at System.Collections.Generic.AbpDictionaryExtensions.<>c__DisplayClass7_02.<GetOrAdd>b__0(TKey k) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at System.Collections.Generic.AbpDictionaryExtensions.GetOrAdd[TKey,TValue](ConcurrentDictionary2 dictionary, TKey key, Func1 factory) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleCache.GetOrAdd(String bundleName, Func1 factory) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleManager.GetBundleFilesAsync(BundleConfigurationCollection bundles, String bundleName, IBundler bundler) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleManager.GetStyleBundleFilesAsync(String bundleName) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpTagHelperStyleService.GetBundleFilesAsync(String bundleName) at Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpTagHelperResourceService.ProcessAsync(ViewContext viewContext, TagHelper tagHelper, TagHelperContext context, TagHelperOutput output, List`1 bundleItems, String bundleName)

at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request) at System.Net.Http.HttpClient.CheckRequestBeforeSend(HttpRequestMessage request) at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at System.Net.Http.HttpClient.GetAsync(Uri requestUri) at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReport(HealthCheckConfiguration configuration) 2022-03-12 16:07:31.906 +03:00 [INF] Application started. Press Ctrl+C to shut down.*

Please help support me to deploy it


36 Answer(s)
  • 0
    maliming created
    Support Team

    Did you publish the wwwroot directory? To restore the wwwroot directory using abp install-libs

  • 0
    piseth created

    I publish the website on my local PC. Then I copy the publish folder to paste in wwwroot in my server. my server has no Internet connection. **I will try run abp install-libs before publish it. ** By the way, currently i use the default appsettings.json which "App": { "SelfUrl":"https://localhost:44346" }, "AuthServer": { "Authority":"https://localhost:44346", "RequireHttpsMetadata":"false" },...

    On my server, i want to browse http://10.10.0.1 or https://10.10.0.1 => Should I change my default appsettings.json?

    Thanks

  • 0
    piseth created

    Did you publish the wwwroot directory? To restore the wwwroot directory using abp install-libs

    On my local laptop, i run abp install-libs and all required libraries are copied to MyProject.Web/wwwroot/libs. However abp libraries and some of other libraries are not copied to bin/Release/net6.0/publish/wwwroot/libs, after I published from Visual Studio Community 2022 (64-bit)

    In this case, can i copy manually the folder libs and paste in bin/Release/net6.0/publish/wwwroot/libs ?

  • 0
    maliming created
    Support Team

    Try this?

    <ItemGroup>
        <Content Include="wwwroot\**\*">
          <CopyToPublishDirectory>Always</CopyToPublishDirectory>
        </Content>
    </ItemGroup>
    
  • 0
    piseth created

    CopyToPublishDirectory

    I follow you by adding in MyProject.Web.csproj and i rebuild my solution but i get the following errors:

  • 0
    maliming created
    Support Team

    hi

    can i copy manually the folder libs and paste in bin/Release/net6.0/publish/wwwroot/libs ?

    You can try this. Copy wwwrrot to the IIS website directory.

  • 0
    piseth created

    hi

    can i copy manually the folder libs and paste in bin/Release/net6.0/publish/wwwroot/libs ?

    You can try this. Copy wwwrrot to the IIS website directory.

    Hi,

    I follow your instruction.

    1/ i publish my web again in VS 2022 2/ I manually copy libs folder and paste it in wwwroot 3/ I sftp to my server and put it under c:\inetpub\wwwroot\qoe 4/ i restart my site in IIS manager

    I can browse it but it looks not fully correct. My logo is not shown and the theme is not fully shown properly. After I login, it brings me to show Error 400 - httpStatusCode=400. Please see the attached images.

    The following is the some logs:

    =================================================================== System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set. at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request) at System.Net.Http.HttpClient.CheckRequestBeforeSend(HttpRequestMessage request) at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at System.Net.Http.HttpClient.GetAsync(Uri requestUri) at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReport(HealthCheckConfiguration configuration) 2022-03-16 12:19:21.321 +03:00 [INF] Notification is sent on same window time. 2022-03-16 12:19:22.220 +03:00 [INF] > Minified /libs/devextreme/js/dx.all.js (4951064 bytes -> 4898570 bytes) 2022-03-16 12:19:22.253 +03:00 [INF] > Minified /libs/devextreme/js/dx.aspnet.mvc.js (8857 bytes -> 3525 bytes) 2022-03-16 12:19:22.258 +03:00 [INF] > Minified /libs/devextreme/js/dx.aspnet.data.js (13456 bytes -> 4550 bytes) 2022-03-16 12:19:22.287 +03:00 [INF] Bundled __bundles/Asiacell.Web.Bundling.DevExtremeScriptContributor.40C91FA5677011A0B991F380F3039C38.js (8175615 bytes) 2022-03-16 12:19:22.681 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: SettingManagement.Emailing 2022-03-16 12:19:22.683 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: AbpIdentity.SettingManagement 2022-03-16 12:19:22.689 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: LeptonThemeManagement.Settings 2022-03-16 12:19:22.691 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: AbpAccount.SettingManagement 2022-03-16 12:19:22.692 +03:00 [INF] Authorization failed. These requirements were not met:

    ......

    2022-03-16 12:22:01.511 +03:00 [ERR] GetHealthReport threw an exception when trying to get report from /health-status configured with name Asiacell Health Status. System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set. at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request) at System.Net.Http.HttpClient.CheckRequestBeforeSend(HttpRequestMessage request) at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at System.Net.Http.HttpClient.GetAsync(Uri requestUri) at HealthChecks.UI.Core.HostedService.HealthCheckReportCollector.GetHealthReport(HealthCheckConfiguration configuration)


    2022-03-16 12:20:02.061 +03:00 [INF] Request starting HTTP/2 GET https://10.21.161.202:44346/__bundles/Asiacell.Web.Bundling.DevExtremeScriptContributor.40C91FA5677011A0B991F380F3039C38.js?_v=637830191622998915 - - 2022-03-16 12:20:02.061 +03:00 [INF] The file /__bundles/Asiacell.Web.Bundling.DevExtremeScriptContributor.40C91FA5677011A0B991F380F3039C38.js was not modified 2022-03-16 12:20:02.061 +03:00 [INF] Request finished HTTP/2 GET https://10.21.161.202:44346/__bundles/Asiacell.Web.Bundling.DevExtremeScriptContributor.40C91FA5677011A0B991F380F3039C38.js?_v=637830191622998915 - - - 304 - application/javascript 0.4689ms 2022-03-16 12:20:02.062 +03:00 [INF] Request starting HTTP/2 GET https://10.21.161.202:44346/__bundles/Lepton.Global.BF1167448374F84512EABF50AAAB3042.js?_v=637830191639694672 - - 2022-03-16 12:20:02.062 +03:00 [INF] The file /__bundles/Lepton.Global.BF1167448374F84512EABF50AAAB3042.js was not modified 2022-03-16 12:20:02.062 +03:00 [INF] Request finished HTTP/2 GET https://10.21.161.202:44346/__bundles/Lepton.Global.BF1167448374F84512EABF50AAAB3042.js?_v=637830191639694672 - - - 304 - application/javascript 0.4423ms


  • 0
    maliming created
    Support Team

    hi

    You can try dotnet publish command to publish the website.

    https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-6.0&tabs=netcore-cli

    There is an error on your site.

  • 0
    piseth created

    https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-6.0&tabs=netcore-cli

    If my site has error, why i can run it with both Debug and Release on VS 2022? Certificate error is shown because I use https and i don't have a trusted certificate. If i use normal http => it won't show.

    In log, why does it show: 1/ PermissionRequirement: AbpAccount.SettingManagement? 2/ System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.

    Do i have to configure something in my project before publishing on the server?

  • 0
    maliming created
    Support Team

    https://zoom.us/j/95815890202?pwd=VnZaVXl6MTM2OWV4M2czcVdVbzlQUT09

  • 0
    maliming created
    Support Team

    Let's check it on the meeting.

  • 0
    piseth created

    https://zoom.us/j/95815890202?pwd=VnZaVXl6MTM2OWV4M2czcVdVbzlQUT09

    It shows Invalid Meeting ID.

    By the way, my problem is similar to this ticket but they use Angular. https://support.abp.io/QA/Questions/1179/Cannot-login-through-api

    My log is like the following. Can you help? 2022-03-17 10:33:38.696 +03:00 [INF] Antiforgery token validation failed. The required antiforgery cookie ".AspNetCore.Antiforgery.oLLsTIB8lzc" is not present. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.oLLsTIB8lzc" is not present. at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.ValidateRequestAsync(HttpContext httpContext) at Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.ValidateAntiforgeryTokenAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context)

  • 0
    piseth created

    I add this following into my MyProjectWebModule.cs:

    private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddAuthentication() .AddJwtBearer(options => { options.Authority = configuration["AuthServer:Authority"]; options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]); ; options.Audience = "MyProject";

               * options.BackchannelHttpHandler = new HttpClientHandler()
                {
                    ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
                };*
    
            });
    }
    

    ****** I still get the following error:
    Antiforgery token validation failed. The required antiforgery cookie ".AspNetCore.Antiforgery.oLLsTIB8lzc" is not present. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.oLLsTIB8lzc" is not present. ....... .............. System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

  • 0
    maliming created
    Support Team

    hi

    Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.

    Please share the full error info. includes request start and end.

  • 0
    piseth created

    hi

    Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.

    Please share the full error info. includes request start and end.

    Hello,

    On my IIS, i add a trusted SSL certificate, and now there is NO error for the following: *System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch *

    =====>>>THE REMAINING ERRORS ARE : 2022-03-18 08:54:37.514 +03:00 [INF] End processing HTTP request after 9.7556ms - 200 2022-03-18 08:54:37.514 +03:00 [INF] Request finished HTTP/1.1 GET https://qoe.myproject.com/health-status - - - 200 - application/json 9.2139ms 2022-03-18 08:54:45.521 +03:00 [INF] Request starting HTTP/2 POST https://qoe.myproject.com/Account/Login application/x-www-form-urlencoded 497 2022-03-18 08:54:45.538 +03:00 [INF] Executing endpoint '/Account/Login' 2022-03-18 08:54:45.539 +03:00 [INF] Route matched with {page = "/Account/Login", action = "", controller = "", area = ""}. Executing page /Account/Login 2022-03-18 08:54:45.539 +03:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2022-03-18 08:54:45.541 +03:00 [INF] Antiforgery token validation failed. The required antiforgery cookie ".AspNetCore.Antiforgery.oLLsTIB8lzc" is not present. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.oLLsTIB8lzc" is not present. at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.ValidateRequestAsync(HttpContext httpContext) at Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.ValidateAntiforgeryTokenAuthorizationFilter.OnAuthorizationAsync(AuthorizationFilterContext context) 2022-03-18 08:54:45.541 +03:00 [INF] Authorization failed for the request at filter 'Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.AutoValidateAntiforgeryTokenAuthorizationFilter'. 2022-03-18 08:54:45.546 +03:00 [INF] Executing StatusCodeResult, setting HTTP status code 400 2022-03-18 08:54:45.546 +03:00 [INF] Executed page /Account/Login in 7.7423ms 2022-03-18 08:54:45.546 +03:00 [INF] Executed endpoint '/Account/Login' 2022-03-18 08:54:45.826 +03:00 [INF] Request finished HTTP/2 POST https://qoe.myproject.com/Account/Login application/x-www-form-urlencoded 497 - 302 - - 305.0401ms 2022-03-18 08:54:45.831 +03:00 [INF] Request starting HTTP/2 GET https://qoe.myproject.com/Error?httpStatusCode=400 - - 2022-03-18 08:54:45.835 +03:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController.Index (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)' 2022-03-18 08:54:45.839 +03:00 [INF] Route matched with {action = "Index", controller = "Error", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Index(Int32) on controller Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers.ErrorController (Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared). 2022-03-18 08:54:45.868 +03:00 [INF] Executing ViewResult, running view ~/Views/Error/Default.cshtml. 2022-03-18 08:54:45.903 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: SettingManagement.Emailing 2022-03-18 08:54:45.903 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: AbpIdentity.SettingManagement 2022-03-18 08:54:45.905 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: LeptonThemeManagement.Settings 2022-03-18 08:54:45.905 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: AbpAccount.SettingManagement 2022-03-18 08:54:45.905 +03:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: CmsKit.SettingManagement

  • 0
    maliming created
    Support Team

    hi

    The https will redirect to http, http responds with 404. Did you bind http?

  • 0
    piseth created

    Hello sir,

    Thanks so much for your reply and support.

    I go to my server and i add a new site binding, but i still see the same errors. Please see the attached images. If you find any missing at my side, i appreciate.

    Within Internet Explorer, I cannot login and cannot do anything. However, if i use Google Chrome to browse it, I can login and View and Add information. BUT I cannot Delete or Edit. Please see the following error when I am trying to delete:

  • 0
    maliming created
    Support Team

    HTTP 405

    See https://mozartec.com/asp-net-core-error-405-methods-not-allowed-for-put-and-delete-requests-when-hosted-on-iis/

  • 0
    piseth created

    HTTP 405

    See https://mozartec.com/asp-net-core-error-405-methods-not-allowed-for-put-and-delete-requests-when-hosted-on-iis/

    Hi,

    Thank you so much. After modifying my web.config by following your instruction, i can add/edit/delete by using Google Chrome.

    Within Internet Explorer, I still cannot login and cannot do anything. Why is it like that? How to solve it?

  • 0
    maliming created
    Support Team

    Within Internet Explorer, I still cannot login and cannot do anything.

    Please check the console of IE. what's the version?

  • 0
    piseth created

    Within Internet Explorer, I still cannot login and cannot do anything.

    Please check the console of IE. what's the version?

  • 0
    maliming created
    Support Team

    Please check the console of IE

    https://www.ibm.com/support/pages/how-use-ie-11-f12-developer-tools-capture-browser-console-log-and-network-log-omnibus-webgui

  • 0
    piseth created

    Please check the console of IE

    https://www.ibm.com/support/pages/how-use-ie-11-f12-developer-tools-capture-browser-console-log-and-network-log-omnibus-webgui

    I cannot open Developer Tool in my server, but i can open Developer tool on my local laptop Here are the Console logs:

  • 0
    maliming created
    Support Team

    I think the browser version is too low.

    https://jquery.com/browser-support/ https://getbootstrap.com/docs/5.0/getting-started/browsers-devices/

  • 0
    piseth created

    I think the browser version is too low.

    https://jquery.com/browser-support/ https://getbootstrap.com/docs/5.0/getting-started/browsers-devices/

    I tested with my laptop installed with Window 10, and its IE does not work with the application. Abp is not supported with IE?

  • 0
    maliming created
    Support Team

    HI

    Can you try to set the Bundling Mode to Bundle?

    https://docs.abp.io/en/abp/latest/UI/AspNetCore/Bundling-Minification#bundling-mode

  • 0
    piseth created

    HI

    Can you try to set the Bundling Mode to Bundle?

    https://docs.abp.io/en/abp/latest/UI/AspNetCore/Bundling-Minification#bundling-mode

    Hi, Thanks so much. I am trying. I will come back to you.

  • 0
    maliming created
    Support Team

    ok. : )

  • 0
    piseth created

    Hi,

    I tried all these options in MyProjectWebModule.cs, but still cannot help me.

    • Auto: Automatically determines the mode based on the environment.
    • None: No bundling or minification.
    • Bundle: Bundled but not minified.
    • BundleAndMinify: Bundled and minified.
  • 0
    maliming created
    Support Team

    hi

    Can you share your website URL? [email protected] I will test it in IE.

  • 0
    piseth created

    hi

    Can you share your website URL? [email protected] I will test it in IE.

    i did not publish it outside. How about if i zip the folder (which is located under C:\inetpub\wwwroot) and send to you? Then you put it in your PC under C:\inetpub\wwwroot and you can test it. May be my project is missing any important things

    **I already shared it with you. plz check **

  • 0
    maliming created
    Support Team

    OK, I will check it.

  • 0
    maliming created
    Support Team

    HI

    Bootstrap v5: Internet Explorer is not supported. If you require Internet Explorer support, please use Bootstrap v4.

    https://getbootstrap.com/docs/5.0/getting-started/browsers-devices/#internet-explorer

  • 0
    piseth created

    HI

    Bootstrap v5: Internet Explorer is not supported. If you require Internet Explorer support, please use Bootstrap v4.

    https://getbootstrap.com/docs/5.0/getting-started/browsers-devices/#internet-explorer

    Thanks so much If i want to use the Bootstrap v4, i have to downgrade the version of Abp Commercial?

  • 0
    maliming created
    Support Team

    Yes, But I don't recommend to downgrade.

  • 0
    piseth created

    Yes, But I don't recommend to downgrade.

    Thanks so much