Open Closed

Support for deploy both angular and asp-net core on single azure web service #1473


0
Ravisha created
  • ABP Framework version: v4.3
  • UI type: Angular
  • DB provider: EF Core
  • Identity Server Separated (Angular):No
  • ABP Commercial application

Hi Team,

I'm trying to deploy both angular and asp-net core on single azure web service. Here is my project structure I have included the following source package(code) to my application 1. Account.pro module 2. LeptonTheme

Deployement steps to azure:

  1. I have deployed HttpApi.Host application to azure web service(https://abptest-dev.azurewebsites.net)
  2. I have deployed angular app to same azure web service(https://abptest-dev.azurewebsites.net) Both these application are deployed to root folder (say [wwwroo in](http://wwwroo](http://wwwroo in in) azure)

HttpApi.Host application is working perfectly fine, swagger api is working fine as i can autorise to login for swagger and i can call api's throught swagger. Login is also working with url: https://abptest-dev.azurewebsites.net/account/login

Angular application is not loading, attached the picture

Asp-net core configuration Details: Appsettings.json

    "SelfUrl": "https://abptest-dev.azurewebsites.net",
    "AngularUrl": "https://abptest-dev.azurewebsites.net",
    "CorsOrigins": "https://*.abptest-dev.azurewebsites.net,http://abptest-dev.azurewebsites.net",
    "RedirectAllowedUrls": "http://abptest-dev.azurewebsites.net,https://abptest-dev.azurewebsites.net"
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  }
  "AuthServer": {
    "Authority": "https://abptest-dev.azurewebsites.net",
    "RequireHttpsMetadata": "false",
    "SwaggerClientId": "abptest_Swagger",
    "SwaggerClientSecret": "1q2w3e*"
  },

Angular configuration:

Environment.prod.ts

import { Environment } from '@abp/ng.core';

const baseUrl = 'http://abptest-dev.azurewebsites.net';

export const environment = {
  production: true,
  application: {
    baseUrl,
    name: 'abptest',
  },
  oAuthConfig: {
    issuer: 'https://abptest-dev.azurewebsites.net',
    redirectUri: baseUrl,
    clientId: 'abptest_App',
    responseType: 'code',
    scope: 'offline_access openid profile role email phone abptest',
  },
  apis: {
    default: {
      url: '',
      rootNamespace: 'abptest',
    },
  },
} as Environment;

Could you please let me know is model deployment will work or supportted by ABP. if yes What configuration is missing?


49 Answer(s)
  • 0
    maliming created
    Support Team

    hi

    Can you share the details of error?

    Do you have a web.config file? What is the content?

  • 0
    Ravisha created

    hi

    Can you share the details of error?

    Do you have a web.config file? What is the content?

    Here is the error log:

    2021-06-14 05:32:07.504 +00:00 [INF] - Volo.Abp.Swashbuckle.AbpSwashbuckleModule 2021-06-14 05:32:07.504 +00:00 [INF] - Volo.Abp.AspNetCore.Serilog.AbpAspNetCoreSerilogModule 2021-06-14 05:32:10.980 +00:00 [INF] Starting IdentityServer4 version 4.1.1+cebd52f5bc61bdefc262fd20739d4d087c6f961f 2021-06-14 05:32:13.963 +00:00 [INF] Using the default authentication scheme Identity.Application for IdentityServer 2021-06-14 05:32:18.292 +00:00 [INF] Initialized all ABP modules. 2021-06-14 05:32:18.899 +00:00 [INF] Now listening on: http://127.0.0.1:35308 2021-06-14 05:32:18.899 +00:00 [INF] Application started. Press Ctrl+C to shut down. 2021-06-14 05:32:18.899 +00:00 [INF] Hosting environment: CI 2021-06-14 05:32:18.899 +00:00 [INF] Content root path: D:\home\site\wwwroot 2021-06-14 05:32:20.215 +00:00 [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/ - - 2021-06-14 05:32:20.467 +00:00 [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/ - - 2021-06-14 05:32:28.293 +00:00 [INF] Executing endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-14 05:32:28.304 +00:00 [INF] Executing endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-14 05:32:28.420 +00:00 [INF] Route matched with {action = "Index", controller = "Home", area = "", page = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult Index() on controller abptest.Controllers.HomeController (abptest.HttpApi.Host). 2021-06-14 05:32:28.428 +00:00 [INF] Route matched with {action = "Index", controller = "Home", area = "", page = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult Index() on controller abptest.Controllers.HomeController (abptest.HttpApi.Host).

    I haven't done any modification or chnages to web.config, I'm using the original web.config here is the content of web.config.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <location path="." inheritInChildApplications="false">
        <system.webServer>
          <handlers>
            <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
          </handlers>
          <aspNetCore processPath="dotnet" arguments=".\abptest.HttpApi.Host.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="OutOfProcess" />
        </system.webServer>
      </location>
    </configuration>
    

    I have commeted out the health check in HealthcheckBuilderExtension.cs as mentioned below

    // If you don't want to add HealthChecksUI, remove following configurations.
        //var healthChecksUiBuilder = services.AddHealthChecksUI(settings =>
        //{
        //    settings.AddHealthCheckEndpoint("abptest Health Status", "/health-status");
        //});
    
        // Set your HealthCheck UI Storage here
        //healthChecksUiBuilder.AddInMemoryStorage();
    
        //services.MapHealthChecksUiEndpoints(options =>
        //{
        //    options.UIPath = "/health-ui";
        //    options.ApiPath = "/health-api";
        //});
    

    I have chnaged the the home redirect url to index.html as mentioned below in Home Controller of HttpApi.Host

    //return Redirect("~/swagger");
    return Redirect("/index.html");
    

    Looks like SPA Client has not read or it is not able to load the angular, this is my suspection.

  • 0
    Ravisha created

    Hi Maliming,

    Could you please let me know if you need more details.

    Thanks

  • 0
    maliming created
    Support Team

    hi Ravisha

    It seems to be the right approach. return Redirect("/index.html");

    Does the first load work now? Does the routing work after refreshing the page?

    There is example to handle the refresh.

    <!-- IIS URL Rewrite for Angular routes -->
    <rewrite>
      <rules>
        <rule name="Angular Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
          </conditions>
          <action type="Rewrite" url="/" />
        </rule>
      </rules>
    </rewrite>
    
  • 0
    maliming created
    Support Team

    hi

    return Redirect("/index.html"); Does the first load work now? Does the routing work after refreshing the page?

  • 0
    Abhinandan created

    hi

    return Redirect("/index.html"); Does the first load work now? Does the routing work after refreshing the page?

    Hi Maliming,

    This is Abhi from same team and we are working on the same issue. In fact we have tried adding the <rewrite> rule and angular route didn't load after that only we have decided to ask question here.

    Abhi.

  • 0
    maliming created
    Support Team

    hi

    angular route didn't load after that

    Can you share the browser's console & app logs?

  • 0
    Abhinandan created

    hi

    angular route didn't load after that

    Can you share the browser's console & app logs?

    Browser's console log attached in the attachment.

    Here is the error log:

    Microsoft.AspNetCore.Mvc.ActionResult Index() on controller PearlDocs.Controllers.HomeController (abptest.HttpApi.Host). 2021-06-15 06:21:17.963 +00:00 [INF] Executing RedirectResult, redirecting to /index.html. 2021-06-15 06:21:17.963 +00:00 [INF] Executed action abptest.Controllers.HomeController.Index (abptest.HttpApi.Host) in 0.8016ms 2021-06-15 06:21:17.963 +00:00 [INF] Executed endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-15 06:21:17.963 +00:00 [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0 - 302 0 - 53.0249ms 2021-06-15 06:21:18.024 +00:00 [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/index.html - - 2021-06-15 06:21:18.078 +00:00 [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/index.html - - - 302 0 - 53.7046ms 2021-06-15 06:21:18.146 +00:00 [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0 2021-06-15 06:21:18.198 +00:00 [INF] Executing endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-15 06:21:18.198 +00:00 [INF] Route matched with {action = "Index", controller = "Home", area = "", page = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult Index() on controller abptest.Controllers.HomeController (abptest.HttpApi.Host). 2021-06-15 06:21:18.199 +00:00 [INF] Executing RedirectResult, redirecting to /index.html. 2021-06-15 06:21:18.199 +00:00 [INF] Executed action abptest.Controllers.HomeController.Index (abptest.HttpApi.Host) in 0.7548ms 2021-06-15 06:21:18.199 +00:00 [INF] Executed endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-15 06:21:18.199 +00:00 [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0 - 302 0 - 53.4134ms 2021-06-15 06:21:18.268 +00:00 [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/index.html - - 2021-06-15 06:21:18.316 +00:00 [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/index.html - - - 302 0 - 48.1551ms 2021-06-15 06:21:18.385 +00:00 [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0 2021-06-15 06:21:18.437 +00:00 [INF] Executing endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-15 06:21:18.437 +00:00 [INF] Route matched with {action = "Index", controller = "Home", area = "", page = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult Index() on controller abptest.Controllers.HomeController (abptest.HttpApi.Host). 2021-06-15 06:21:18.438 +00:00 [INF] Executing RedirectResult, redirecting to /index.html. 2021-06-15 06:21:18.438 +00:00 [INF] Executed action abptest.Controllers.HomeController.Index (abptest.HttpApi.Host) in 0.808ms 2021-06-15 06:21:18.438 +00:00 [INF] Executed endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-15 06:21:18.438 +00:00 [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0 - 302 0 - 53.4104ms 2021-06-15 06:21:18.507 +00:00 [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/index.html - - 2021-06-15 06:21:18.559 +00:00 [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/index.html - - - 302 0 - 52.5579ms 2021-06-15 06:21:18.633 +00:00 [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0 2021-06-15 06:21:18.684 +00:00 [INF] Executing endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-15 06:21:18.685 +00:00 [INF] Route matched with {action = "Index", controller = "Home", area = "", page = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult Index() on controller abptest.Controllers.HomeController (abptest.HttpApi.Host). 2021-06-15 06:21:18.685 +00:00 [INF] Executing RedirectResult, redirecting to /index.html. 2021-06-15 06:21:18.685 +00:00 [INF] Executed action abptest.Controllers.HomeController.Index (abptest.HttpApi.Host) in 0.7635ms 2021-06-15 06:21:18.685 +00:00 [INF] Executed endpoint 'abptest.Controllers.HomeController.Index (abptest.HttpApi.Host)' 2021-06-15 06:21:18.685 +00:00 [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0 - 302 0 - 52.4167ms

  • 0
    Abhinandan created

    Hi Mailming,

    Ravisha is not able to answer to your reply from his account as always he is getting error popup saying "you are not authorized"

  • 0
    maliming created
    Support Team

    hi @Abhinandan

    The index.html exists in wwwroot folder, right? Can you confirm?

  • 0
    maliming created
    Support Team

    Ravisha is not able to answer to your reply from his account as always he is getting error popup saying "you are not authorized"

    Can you try to re-login?

  • 0
    Abhinandan created

    Ravisha is not able to answer to your reply from his account as always he is getting error popup saying "you are not authorized"

    Can you try to re-login?

    I wil ask Ravisha to re-login and try again.

  • 0
    Abhinandan created

    hi @Abhinandan

    The index.html exists in wwwroot folder, right? Can you confirm?

    Yes. Index.html(of angular) is available in wwwroot..

  • 0
    maliming created
    Support Team

    hi

    It seems that your application did not find this file.

    [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/index.html - - - 302 0 - 52.5579ms
    [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0
    

    I add a index.html file to wwwroot and http://localhost/index.html works.

  • 0
    Ravisha created

    hi

    It seems that your application did not find this file.

    [INF] Request finished HTTP/1.1 GET http://abptest-dev.azurewebsites.net/index.html - - - 302 0 - 52.5579ms 
    [INF] Request starting HTTP/1.1 GET http://abptest-dev.azurewebsites.net/?httpStatusCode=404 - 0 
    

    I add a index.html file to wwwroot and http://localhost/index.html works.

    Yes, application is not finding the index.html from root. any suggetions for this.

  • 0
    maliming created
    Support Team

    I need the steps to reproduce this problem. Can you try it in your local computer ?

  • 0
    Ravisha created

    I need the steps to reproduce this problem. Can you try it in your local computer ?

    On my local computer, no issue it works fine.

    Steps Reproduce:

    1. Genarated app using abp suite with following details ABP Framework version: v4.3 UI type: Angular DB provider: EF Core Identity Server Separated (Angular):No
    2. I have included the following module source package(code) to my application
      • Account.pro module
      • LeptonTheme
    3. Created DB and run the migration using above mentioned configuartion in appsettings.jon of DBMigration project
    4. Deployed the angular app using visual studio code
    5. Deployed the Asp-net core app using visual studio
  • 0
    albert created
    Support Team

    check out :

    • https://stackoverflow.com/questions/62055847/how-to-deploy-angular-spa-with-asp-net-core-3-1-api-on-iis
    • https://www.codementor.io/@noorsaifi/how-to-deploy-angular-asp-net-core-webapi-to-iis-on-shared-hosting-1dytrihj56
  • 0
    Ravisha created

    Thanks Mailmin, We can try this which is standard asp net core and spa integration. for this we have to change the copy angular code inside the asp-net and needs to change abp code(what all code and also need to add the yarn buid:prod command inside the abp host csproj) and i'm not sure that this will work or not? I have already spend more than 2 days for this. if you have steps to do this please let me know? we didn't investigate this deployment challenges during our evaluation abp framework as we thought this is very basic in architecure which abp would have taken care. or can i try deploy using domainresolver way and i see document is very clear in abp documention site?I hope if configure using domainresolver way it will work as many people tried this way and i could see they are succeded in this way?.

  • 0
    maliming created
    Support Team

    hi

    I will try to deploy and share the steps to you.

  • 0
    maliming created
    Support Team

    hi @Ravisha

    I realized that we don't need use IIS URL Rewrite, also no need to change your web.config, I just changed my HomeController.

    public class HomeController : AbpController
    {
    	public ActionResult Index()
    	{
    		return Redirect("~/index.html" + HttpContext.Request.QueryString);
    	}
    }
    

    Everything is working now.

    You can try it, if there is still a problem, I can check it remotely.

  • 0
    Ravisha created

    hi @Ravisha

    I realized that we don't need use IIS URL Rewrite, also no need to change your web.config, I just changed my HomeController.

    public class HomeController : AbpController 
    { 
      public ActionResult Index() 
      { 
      	return Redirect("~/index.html" + HttpContext.Request.QueryString); 
      } 
    } 
    

    Everything is working now.

    You can try it, if there is still a problem, I can check it remotely.

    Thanks Mailming.

    Actually I have reverted and trying use domainresolver way of solving this problem as i mentioned in the prevoius reply. I'm in the middle of this approach. Anyway I will setup one more environment and i will try these changes in that environment. I will let you know the updates.

  • 0
    Ravisha created

    Hi Mailming,

    Sorry, I din't get time to continue my investigation with domainresolver approach as I was busy with other high priority issue. as of I could see angular is loading without adding <rewrite> rule web.xml and also copying index.html to wwwroot but I could see other issue. I continue tomorrow I will update soon on this approach.

    By way collegue tried with old apprach with your suggetion(Redirect("~/index.html" + HttpContext.Request.QueryString)) and but azure ecpects a index.html page at wwwroot/wwwroot folder not at the wwwroot folder of azure to load the angular. In this way he was able to load the index page but dependend js and routing files are wwwroot folder so in browser say 404 for all those files. I will try to get those detailed info as well.

  • 0
    maliming created
    Support Team

    hi

    but azure ecpects a index.html page at wwwroot/wwwroot folder not at the wwwroot folder

    I don't know much about azure, I just tested it successfully in the local IIS.

  • 0
    Ravisha created

    Hi Maliming,

    It works in IIS but not Azure web service, it is expecting in subfolder. As I communicated earlier I couldn't get time to continue with DomainResolver approach(There I have could see angular page loading and i have faced client server configuration issues). I continue to try next week(coming Monday), if you have any steps/document links please share, so that I will not get stuck monday. I have to resolve this issue by Monday/Tuesday. I will keep posting the updates for your information.

    Note:our production deployment approach -->I'm trying to deploy both angular and asp-net core on one azure web app service and tenants will using https://{TenantName}.hostname.com.

  • 0
    Ravisha created

    Hi Mailming,

    with DomainResolver approch, it started working. but I don't see tenant swith(I hope is expected behavior) but

    1. If I create/add user in teant say t1. user is created in both tenant t1(t1.abptest.com) and also main site(abptest.com). because of this mylinkuser functionality is breaking and it redirecting to abptest.com always.
    2. Register is not working
    3. My User Links is also not working

    *my DBmigration appsettings

    "ConnectionStrings": {
        
      },
      "IdentityServer": {
        "Clients": {
          "AbpTest_Web": {
            "ClientId": "AbpTest_Web",
            "RootUrl": "https://{0}.abptest-dev.azurewebsites.net/"
          },
          "AbpTest_Web_Public": {
            "ClientId": "AbpTest_Web_Public",
            "RootUrl": "https://abptest-dev.azurewebsites.net/"
          },
          "AbpTest_Web_Public_Tiered": {
            "ClientId": "AbpTest_Web_Public_Tiered",
            "RootUrl": "https://abptest-dev.azurewebsites.net/"
          },
          "AbpTest_App": {
            "ClientId": "AbpTest_App",
            "RootUrl": "https://{0}.abptest-dev.azurewebsites.net/"
          },     
           "AbpTest_Swagger": {
            "ClientId": "AbpTest_Swagger",
            "RootUrl": "https://{0}.abptest-dev.azurewebsites.net/"
          }
        }
      }  
    

    appsettings of HttpApi.Host

    {
      {
      "App": {
        "SelfUrl": "https://abptest-dev.azurewebsites.net/",
        "AngularUrl": "https://abptest-dev.azurewebsites.net/",
        "CorsOrigins": "https://*.abptest-dev.azurewebsites.net/,https://abptest-dev.azurewebsites.net/",
        "RedirectAllowedUrls": "http://abptest-dev.azurewebsites.net/, https://abptest-dev.azurewebsites.net/"
      },
      "Redis": {
        "Configuration": "https://abptest-dev.azurewebsites.net/",
        "IsEnabled": "false"
      },
      "AuthServer": {
        "Authority": "https://abptest-dev.azurewebsites.net/",
        "RequireHttpsMetadata": "false",
        "SwaggerClientId": "AbpTest_Swagger",
        "SwaggerClientSecret": "1q2w3e*"
      }  
    }
    

    Angular Environment.ts

    const baseUrl = 'https://{0}.abptest-dev.azurewebsites.net';
    
    export const environment = {
      production: true,
      application: {
        baseUrl,
        name: 'AbpTest',
      },
      oAuthConfig: {
        issuer: 'https://abptest-dev.azurewebsites.net',
        redirectUri: baseUrl,
        clientId: 'AbpTest_App',
        responseType: 'code',
        scope: 'offline_access openid profile role email phone AbpTest',
      },
      apis: {
        default: {
          url: '',
          rootNamespace: 'AbpTest',
        },
      },
    } as Environment;
    

    In HttpApiHost I have added below code

    //To Configure domain Resolver
        context.Services.AddAbpStrictRedirectUriValidator();
        context.Services.AddAbpClientConfigurationValidator();
        context.Services.AddAbpWildcardSubdomainCorsPolicyService();
        Configure<AbpTenantResolveOptions>(options =>
        {
            options.AddDomainTenantResolver("{0}.abptest-dev.azurewebsites.net");
        });
    
        Configure<IdentityServerOptions>(options =>
        {
            options.IssuerUri = configuration["App:SelfUrl"];
        });
    
    Please let me know anything is wrong in configuration.
    
  • 0
    Ravisha created

    Hi Mailming, got any clue on this, I'm waiting for your help.

  • 0
    Ravisha created

    Hi Maliming,

    I'm waiting for your suggestion/advice on this, please let me know if you need more details on this.

    Thanks, Ravisha

  • 0
    maliming created
    Support Team

    hi

    I will check asap. sorry for that.

  • 0
    maliming created
    Support Team

    hi

    it started working. but I don't see tenant swith(I hope is expected behavior)

    This is expected. The application always tries to resolve the tenant from the domain name.

    1. If I create/add user in teant say t1. user is created in both tenant t1(t1.abptest.com) and also main site(abptest.com). because of this mylinkuser functionality is breaking and it redirecting to abptest.com always.
    2. Register is not working
    3. My User Links is also not working

    Can you share some screenshots or log info?

    Can you check if the current tenant is a domain name? Maybe it is not working properly.

    We have related sample. https://github.com/abpframework/abp-samples/tree/master/DomainTenantResolver#angular https://github.com/abpframework/abp-samples/tree/master/DomainTenantResolver/NG

  • 0
    Ravisha created

    Hi Maliming,

    I have refferred the links you provided and here is results:

    When I logged with url https://apbtest.com

    2021-06-28 07:05:41.929 +00:00 [INF] Request starting HTTP/1.1 GET https://AbpTest.com/connect/authorize?response_type=code&client_id=AbpTest_App&state=OWJsMnctaVJITlJNVEJ6SGlkOE9Fb0wzYXBMUFB6bEQ1YS1QVndvR3NWcWVJ&redirect_uri=https%3A%2F%2FAbpTest.com&scope=offline_access%20openid%20profile%20role%20email%20phone%20AbpTest&code_challenge=pGFRBF6JXiKpIshgnVW5aEwcOAfS0V3iBt_faPFnCmo&code_challenge_method=S256&nonce=OWJsMnctaVJITlJNVEJ6SGlkOE9Fb0wzYXBMUFB6bEQ1YS1QVndvR3NWcWVJ&culture=en&ui-culture=en - -
    2021-06-28 07:05:41.989 +00:00 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.AuthorizeEndpoint for /connect/authorize
    2021-06-28 07:05:42.052 +00:00 [ERR] Invalid client configuration for client AbpTest_App: AllowedCorsOrigins contains invalid origin: https://{0}.AbpTest.com
    2021-06-28 07:05:42.053 +00:00 [INF] {"ClientId":"AbpTest_App","ClientName":"AbpTest_App","Category":"Error","Name":"Invalid Client Configuration","EventType":"Error","Id":3001,"Message":"AllowedCorsOrigins contains invalid origin: https://{0}.AbpTest.com","ActivityId":"8000127e-1800-b500-b63f-84710c7967bb","TimeStamp":"2021-06-28T07:05:42.0000000Z","ProcessId":5328,"LocalIpAddress":"10.0.5.115:443","RemoteIpAddress":"113.193.237.54","$type":"InvalidClientConfigurationEvent"}
    2021-06-28 07:05:42.053 +00:00 [ERR] Unknown client or not enabled: AbpTest_App
    {"ClientId":null,"ClientName":null,"RedirectUri":null,"AllowedRedirectUris":null,"SubjectId":"anonymous","ResponseType":null,"ResponseMode":null,"GrantType":null,"RequestedScopes":"","State":null,"UiLocales":null,"Nonce":null,"AuthenticationContextReferenceClasses":null,"DisplayMode":null,"PromptMode":"","MaxAge":null,"LoginHint":null,"SessionId":null,"Raw":{"response_type":"code","client_id":"AbpTest_App","state":"OWJsMnctaVJITlJNVEJ6SGlkOE9Fb0wzYXBMUFB6bEQ1YS1QVndvR3NWcWVJ","redirect_uri":"https://AbpTest.com","scope":"offline_access openid profile role email phone AbpTest","code_challenge":"pGFRBF6JXiKpIshgnVW5aEwcOAfS0V3iBt_faPFnCmo","code_challenge_method":"S256","nonce":"OWJsMnctaVJITlJNVEJ6SGlkOE9Fb0wzYXBMUFB6bEQ1YS1QVndvR3NWcWVJ","culture":"en","ui-culture":"en"},"$type":"AuthorizeRequestValidationLog"}
    2021-06-28 07:05:42.053 +00:00 [ERR] Request validation failed
    2021-06-28 07:05:42.053 +00:00 [INF] {"ClientId":null,"ClientName":null,"RedirectUri":null,"AllowedRedirectUris":null,"SubjectId":"anonymous","ResponseType":null,"ResponseMode":null,"GrantType":null,"RequestedScopes":"","State":null,"UiLocales":null,"Nonce":null,"AuthenticationContextReferenceClasses":null,"DisplayMode":null,"PromptMode":"","MaxAge":null,"LoginHint":null,"SessionId":null,"Raw":{"response_type":"code","client_id":"AbpTest_App","state":"OWJsMnctaVJITlJNVEJ6SGlkOE9Fb0wzYXBMUFB6bEQ1YS1QVndvR3NWcWVJ","redirect_uri":"https://AbpTest.com","scope":"offline_access openid profile role email phone AbpTest","code_challenge":"pGFRBF6JXiKpIshgnVW5aEwcOAfS0V3iBt_faPFnCmo","code_challenge_method":"S256","nonce":"OWJsMnctaVJITlJNVEJ6SGlkOE9Fb0wzYXBMUFB6bEQ1YS1QVndvR3NWcWVJ","culture":"en","ui-culture":"en"},"$type":"AuthorizeRequestValidationLog"}
    2021-06-28 07:05:42.053 +00:00 [INF] {"ClientId":"AbpTest_App","ClientName":null,"RedirectUri":null,"Endpoint":"Authorize","SubjectId":null,"Scopes":"","GrantType":null,"Error":"unauthorized_client","ErrorDescription":"Unknown client or client not enabled","Category":"Token","Name":"Token Issued Failure","EventType":"Failure","Id":2001,"Message":null,"ActivityId":"8000127e-1800-b500-b63f-84710c7967bb","TimeStamp":"2021-06-28T07:05:42.0000000Z","ProcessId":5328,"LocalIpAddress":"10.0.5.115:443","RemoteIpAddress":"113.193.237.54","$type":"TokenIssuedFailureEvent"}
    2021-06-28 07:05:42.055 +00:00 [INF] Request finished HTTP/1.1 GET https://AbpTest.com/connect/authorize?response_type=code&client_id=AbpTest_App&state=OWJsMnctaVJITlJNVEJ6SGlkOE9Fb0wzYXBMUFB6bEQ1YS1QVndvR3NWcWVJ&redirect_uri=https%3A%2F%2FAbpTest.com&scope=offline_access%20openid%20profile%20role%20email%20phone%20AbpTest&code_challenge=pGFRBF6JXiKpIshgnVW5aEwcOAfS0V3iBt_faPFnCmo&code_challenge_method=S256&nonce=OWJsMnctaVJITlJNVEJ6SGlkOE9Fb0wzYXBMUFB6bEQ1YS1QVndvR3NWcWVJ&culture=en&ui-culture=en - - - 302 - - 125.6959ms
    

    When I logged with url https:// t1.apbtest.com here is error logs

    2021-06-28 07:03:13.434 +00:00 [INF] Request finished HTTP/1.1 GET **https://t1.AbpTest.com/**gb.35dbacd736781608964a.svg - - - 200 541 image/svg+xml 15.9464ms
    2021-06-28 07:03:23.530 +00:00 [INF] Request starting HTTP/1.1 GET https://t1.AbpTest.com/connect/authorize?response_type=code&client_id=AbpTest_App&state=SnlzS0Jna01qMHZBLmJZQS1fTGNHVlA3NmRGcFJnY3RUR1FadnNLR0Eyb1FI&redirect_uri=https%3A%2F%2Ft1.AbpTest.com&scope=offline_access%20openid%20profile%20role%20email%20phone%20AbpTest&code_challenge=ce4OrqBCxawtkSe7axF7f9Y4jtiapFSJJ0Rekhj37mE&code_challenge_method=S256&nonce=SnlzS0Jna01qMHZBLmJZQS1fTGNHVlA3NmRGcFJnY3RUR1FadnNLR0Eyb1FI&culture=en&ui-culture=en - -
    2021-06-28 07:03:23.616 +00:00 [INF] Invoking IdentityServer endpoint: IdentityServer4.Endpoints.AuthorizeEndpoint for /connect/authorize
    2021-06-28 07:03:24.851 +00:00 [ERR] Invalid client configuration for client AbpTest_App: AllowedCorsOrigins contains invalid origin: https://{0}.AbpTest.com
    2021-06-28 07:03:24.870 +00:00 [INF] {"ClientId":"AbpTest_App","ClientName":"AbpTest_App","Category":"Error","Name":"Invalid Client Configuration","EventType":"Error","Id":3001,"Message":"AllowedCorsOrigins contains invalid origin: https://{0}.AbpTest.com","ActivityId":"8000b037-1400-3d00-b63f-84710c7967bb","TimeStamp":"2021-06-28T07:03:24.0000000Z","ProcessId":5328,"LocalIpAddress":"10.0.5.115:443","RemoteIpAddress":"113.193.237.54","$type":"InvalidClientConfigurationEvent"}
    2021-06-28 07:03:24.892 +00:00 [ERR] Unknown client or not enabled: AbpTest_App
    {"ClientId":null,"ClientName":null,"RedirectUri":null,"AllowedRedirectUris":null,"SubjectId":"anonymous","ResponseType":null,"ResponseMode":null,"GrantType":null,"RequestedScopes":"","State":null,"UiLocales":null,"Nonce":null,"AuthenticationContextReferenceClasses":null,"DisplayMode":null,"PromptMode":"","MaxAge":null,"LoginHint":null,"SessionId":null,"Raw":{"response_type":"code","client_id":"AbpTest_App","state":"SnlzS0Jna01qMHZBLmJZQS1fTGNHVlA3NmRGcFJnY3RUR1FadnNLR0Eyb1FI","redirect_uri":"https://t1.AbpTest.com","scope":"offline_access openid profile role email phone AbpTest","code_challenge":"ce4OrqBCxawtkSe7axF7f9Y4jtiapFSJJ0Rekhj37mE","code_challenge_method":"S256","nonce":"SnlzS0Jna01qMHZBLmJZQS1fTGNHVlA3NmRGcFJnY3RUR1FadnNLR0Eyb1FI","culture":"en","ui-culture":"en"},"$type":"AuthorizeRequestValidationLog"}
    2021-06-28 07:03:24.897 +00:00 [ERR] Request validation failed
    2021-06-28 07:03:24.901 +00:00 [INF] {"ClientId":null,"ClientName":null,"RedirectUri":null,"AllowedRedirectUris":null,"SubjectId":"anonymous","ResponseType":null,"ResponseMode":null,"GrantType":null,"RequestedScopes":"","State":null,"UiLocales":null,"Nonce":null,"AuthenticationContextReferenceClasses":null,"DisplayMode":null,"PromptMode":"","MaxAge":null,"LoginHint":null,"SessionId":null,"Raw":{"response_type":"code","client_id":"AbpTest_App","state":"SnlzS0Jna01qMHZBLmJZQS1fTGNHVlA3NmRGcFJnY3RUR1FadnNLR0Eyb1FI","redirect_uri":"https://t1.AbpTest.com","scope":"offline_access openid profile role email phone AbpTest","code_challenge":"ce4OrqBCxawtkSe7axF7f9Y4jtiapFSJJ0Rekhj37mE","code_challenge_method":"S256","nonce":"SnlzS0Jna01qMHZBLmJZQS1fTGNHVlA3NmRGcFJnY3RUR1FadnNLR0Eyb1FI","culture":"en","ui-culture":"en"},"$type":"AuthorizeRequestValidationLog"}
    2021-06-28 07:03:24.922 +00:00 [INF] {"ClientId":"AbpTest_App","ClientName":null,"RedirectUri":null,"Endpoint":"Authorize","SubjectId":null,"Scopes":"","GrantType":null,"Error":"unauthorized_client","ErrorDescription":"Unknown client or client not enabled","Category":"Token","Name":"Token Issued Failure","EventType":"Failure","Id":2001,"Message":null,"ActivityId":"8000b037-1400-3d00-b63f-84710c7967bb","TimeStamp":"2021-06-28T07:03:24.0000000Z","ProcessId":5328,"LocalIpAddress":"10.0.5.115:443","RemoteIpAddress":"113.193.237.54","$type":"TokenIssuedFailureEvent"}
    2021-06-28 07:03:25.158 +00:00 [INF] Request finished HTTP/1.1 GET https://t1.AbpTest.com/connect/authorize?response_type=code&client_id=AbpTest_App&state=SnlzS0Jna01qMHZBLmJZQS1fTGNHVlA3NmRGcFJnY3RUR1FadnNLR0Eyb1FI&redirect_uri=https%3A%2F%2Ft1.AbpTest.com&scope=offline_access%20openid%20profile%20role%20email%20phone%20AbpTest&code_challenge=ce4OrqBCxawtkSe7axF7f9Y4jtiapFSJJ0Rekhj37mE&code_challenge_method=S256&nonce=SnlzS0Jna01qMHZBLmJZQS1fTGNHVlA3NmRGcFJnY3RUR1FadnNLR0Eyb1FI&culture=en&ui-culture=en - - - 302 - - 1628.3131ms
    2021-06-28 07:03:25.218 +00:00 [INF] Request starting HTTP/1.1 GET https://t1.AbpTest.com/Account/Error?errorId=CfDJ8BOV1gFzz0RPgGWbIvFzLf2lJjy5G0v09x2j67sNSLw8XBi3vY5SxWLAGb2YcI1JExT8AdF93khWqYphzyycBAhQBM5-yyr_11AGBrfkI-9k7VWCuhZ_V1V7GM_sSOaUykP-QWpFcQE12BF7F4j0jqsSSlGCOXWj1h5s4-RI9C9E_fhsESRuIdEwAbSeUMuAVF3noYwgCQz_WP21j0pnmwStmOr_fM3cULpZCEzqHtqpenqaDIC2A-ZsXqq7wZCSqsL7KESFVc8eMV1OmlFyufgjKeT2pDHDZDcLEz1wqawj-eJh7DfWkOclYw2_RzFyrH_KPkeD8ZMMRJ_FSrXZ_AbWs9sjgKweT1Up9ALWDZA6IBqnmX5epxbudqpOGq9oRg - -
    2021-06-28 07:03:25.290 +00:00 [INF] Executing endpoint 'Volo.Abp.Account.Web.Areas.Account.Controllers.ErrorController.Index (Volo.Abp.Account.Pro.Public.Web.IdentityServer)
    
  • 0
    maliming created
    Support Team

    AllowedCorsOrigins contains invalid origin: https://{0}.AbpTest.com

    This method should resolve this issue, Can you debug it? context.Services.AddAbpClientConfigurationValidator();

    services.Replace(ServiceDescriptor.Transient<IClientConfigurationValidator, AbpClientConfigurationValidator>());
    
    public class AbpClientConfigurationValidator : DefaultClientConfigurationValidator
    {
        public AbpClientConfigurationValidator(IdentityServerOptions options)
            : base(options)
        {
        }
    
        protected override Task ValidateAllowedCorsOriginsAsync(ClientConfigurationValidationContext context)
        {
            context.Client.AllowedCorsOrigins = context.Client
                .AllowedCorsOrigins.Select(x => x.Replace("{0}.", string.Empty, StringComparison.OrdinalIgnoreCase))
                .ToHashSet();
    
            return base.ValidateAllowedCorsOriginsAsync(context);
        }
    }
    
  • 0
    Ravisha created

    Hi Maliming,

    Thanks for the code, but services.Replace(ServiceDescriptor.Transient<IClientConfigurationValidator, AbpClientConfigurationValidator>());

    There is no method called Replace() IcollectionService.

    So I manually updated the database table and after that cors issue resolved. After that I faced one issue, invalid issuer in discovery document expected: https://t1.abptest.com current: https://{0}.abptest.com, for this I have went throug the links you provided and added skipIssuerCheck: true, is this ok for our Production deployement in terms of security?

    As I moved to subdomain resolver way rolving entire this issue, now "my link user" feature is will not working between the tenants. We have requirement one user can login to multiple tenants with same user createntials or different credeantilas, how do we resolve this.

  • 0
    maliming created
    Support Team

    services.Replace(ServiceDescriptor.Transient<IClientConfigurationValidator, AbpClientConfigurationValidator>()); There is no method called Replace() IcollectionService.

    using Microsoft.Extensions.DependencyInjection.Extensions;

    So I manually updated the database table and after that cors issue resolved.

    You shouldn't do that, These extension methods will handle it. Please refer to the demo I provided above.

    AddAbpStrictRedirectUriValidator
    AddAbpClientConfigurationValidator
    AddAbpWildcardSubdomainCorsPolicyService
    

    now "my link user" feature is will not working between the tenants.

    Can you explain? Is there any error or somthing?

    We have requirement one user can login to multiple tenants with same user createntials or different credeantilas, how do we resolve this.

    If this is a new question, please create a new thread.

  • 0
    Ravisha created

    Thnaks for the extension providedand it's wolring without manual intervention with database.

    now "my link user" feature is will not working between the tenants.?

    Meaning as we have moved to subdomain tenant resolver way of resolving problem of angular deployment on same host and same port. because of this, Now Tenant switch is hidden. Now I click on "my link users" from one tenant url(t1.abptest.com), it is not showing the switch to t2.abptest.com. how do we enable the swith when user wants to switch to other tenant?

  • 0
    maliming created
    Support Team

    hi Ravisha

    Can you share some screenshots about "my link user"? Thanks

  • 0
    Ravisha created

    Step1: I logged as tenant 1 with : https://t1.abptest.com

    Step 2: I click on user profile and then click "my link users" menu option

    Step 3: I want switch to https://t2.abptest.com, beacuse I want to link tenat 2 and tenant 1 account.

    Please see the attached screen shots

    Step4 :I'm expecting a tenant switch in login page, so that I can enter "t1" name in the switch and log in to 2nd tenant.

    But I don't see tenant switch option in the login page. so how do i add my link to the other tenant.

  • 0
    maliming created
    Support Team

    hi Ravisha

    But I don't see tenant switch option in the login page. so how do i add my link to the other tenant.

    After you use the domain name to resolve the tenant, you can only manually change the url.

    Change https://t1.abptest.com to https://t2.abptest.com.

  • 0
    Ravisha created

    Hi Mailming,

    Meaning "my link users" functionality will work for domain name to resolve the tenant? it's something like user has logout as tenant1 and lag in as tenant2?

    We want to use "my link users" feature(using domain resolver way) without logging everytime. if "my link users" feature works, user doesn't have go through the login screen everytime when they want swith the tenant. How do we achive this?

    -Ravisha

  • 0
    maliming created
    Support Team

    hi Ravisha

    I will study this situation. and reply to you here. : )

  • 0
    maliming created
    Support Team

    hi Ravisha

    We plan to resolve this issue in 5.0.

  • 0
    Ravisha created

    Thanks Maliming for the update. As we require this feature for our applciation and we'll wait for this feature to be released.

    I just wanted to know what is tentative expected date of Release 5.0?

  • 0
    maliming created
    Support Team

    hi Ravisha

    V5.0 will be available in November. When we finish developing this feature, I will provide you with the code as soon as possible, you don't need to wait until November.

  • 0
    ServiceBot created
    Support Team

    This question has been automatically marked as stale because it has not had recent activity.

  • 0
    Ravisha created

    HI,,

    Please don't mark this question as Stale as we are waiting for response

  • 0
    maliming created
    Support Team

    No problem. : )

  • 0
    maliming created
    Support Team

    hi

    5.0 already supported

    Configure<AbpTenantResolveOptions>(options =>
    {
        options.AddDomainTenantResolver("{0}.getabp.net");
    });
    
    Configure<AbpAccountOptions>(options =>
    {
        options.IsTenantMultiDomain = true;
        options.GetTenantDomain = (httpContext, info) => Task.FromResult(string.IsNullOrWhiteSpace(info.Name) ? $"https://getabp.net" : $"https://{info.Name}.getabp.net");
    });
    
    Configure<AbpAccountIdentityServerOptions>(options =>
    {
        options.IsTenantMultiDomain = true;
        options.GetTenantDomain = (httpContext, extensionGrantValidationContext, info) => Task.FromResult(string.IsNullOrWhiteSpace(info.Name) ? $"https://getabp.net" : $"https://{info.Name}.getabp.net");
    });
    
  • 0
    Ravisha created

    when 5.0 is going to release?

  • 0
    albert created
    Support Team

    5.0 is currently release candidate. we'll publish 5.0.0-rc.2 next week. and after probably 10 days of rc2 stable version will come.