Base solution for your next web application

Activities of "XugoWebTeam"

Hi,

I am using ASP .Net Core & Angular template but cannot find out where to add or edit the edition features. Can you please advise how I can get to the feature setting pages? Thanks!

Kind Regards, Hao

Never mind, I have found it in AppFeatures. Cheers

Question

Hi Team,

I have spent a couple days on the tenant login via subdomian but still cannot make it work properly. My project is Asp.net Core and Angular. It was downloaded in early August which is still the latest version I think.

The client side and host side are both deployed on the server. Below is my appsetting.json: Client Side: "remoteServiceBaseUrl": "http://{TENANCY_NAME}.host.xugo.com.au", "appBaseUrl": "http://{TENANCY_NAME}.portal.xugo.com.au",

Host Side: "ServerRootAddress": "http://{TENANCY_NAME}.host.xugo.com.au", "ClientRootAddress": "http://{TENANCY_NAME}.portal.xugo.com.au", "CorsOrigins": "http://demo.portal.xugo.com.au/,http://portal.xugo.com.au/"

Can you please confirm if the setting are correct? I kept getting the <a class="postlink" href="http://demo.host.xugo.com.au/AbpUserConfiguration/GetAll">http://demo.host.xugo.com.au/AbpUserCon ... ion/GetAll</a> 500 internal error.

If I change the host side setting into "ServerRootAddress": "http://host.xugo.com.au", I won't get error. But login via tenant subdomain does not work. It only accepts the host login.

Thanks a lot!

Answer

looks like a CORS issue?

DEBUG 2017-10-10 02:49:47,611 [libuv] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL8FGP2144VS" started. INFO 2017-10-10 02:49:47,611 [11 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://demo.host.xugo.com.au/AbpUserConfiguration/GetAll">http://demo.host.xugo.com.au/AbpUserCon ... ion/GetAll</a> application/json DEBUG 2017-10-10 02:49:47,611 [11 ] IdentityServer4.CorsPolicyProvider - CORS request made for path: /AbpUserConfiguration/GetAll from origin: <a class="postlink" href="http://demo.portal.xugo.com.au">http://demo.portal.xugo.com.au</a> but rejected because invalid CORS path DEBUG 2017-10-10 02:49:47,611 [11 ] n.Cookies.CookieAuthenticationMiddleware - AuthenticationScheme: Identity.Application was not authenticated. DEBUG 2017-10-10 02:49:47,611 [11 ] IdentityServer4.Hosting.EndpointRouter - No endpoint entry found for request path: /AbpUserConfiguration/GetAll INFO 2017-10-10 02:49:47,611 [11 ] entication.JwtBearer.JwtBearerMiddleware - Successfully validated the token. INFO 2017-10-10 02:49:47,611 [11 ] entication.JwtBearer.JwtBearerMiddleware - HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Bearer. ERROR 2017-10-10 02:49:47,627 [11 ] entication.JwtBearer.JwtBearerMiddleware - Exception occurred while processing message. System.InvalidOperationException: IDX10803: Unable to obtain configuration from: 'http://{TENANCY_NAME}.host.xugo.com.au/.well-known/openid-configuration'. ---> System.IO.IOException: IDX10804: Unable to retrieve document from: 'http://{TENANCY_NAME}.host.xugo.com.au/.well-known/openid-configuration'. ---> System.UriFormatException: Invalid URI: The hostname could not be parsed. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.Uri..ctor(String uriString, UriKind uriKind) at System.Net.Http.HttpClient.CreateUri(String uri) at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.<GetDocumentAsync>d__8.MoveNext() --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.<GetDocumentAsync>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.<GetAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.IdentityModel.Protocols.ConfigurationManager1.<GetConfigurationAsync>d__24.MoveNext() --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.ConfigurationManager1.<GetConfigurationAsync>d__24.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.<HandleAuthenticateAsync>d__1.MoveNext() ERROR 2017-10-10 02:49:47,627 [11 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL8FGP2144VS": An unhandled exception was thrown by the application. System.InvalidOperationException: IDX10803: Unable to obtain configuration from: 'http://{TENANCY_NAME}.host.xugo.com.au/.well-known/openid-configuration'. ---> System.IO.IOException: IDX10804: Unable to retrieve document from: 'http://{TENANCY_NAME}.host.xugo.com.au/.well-known/openid-configuration'. ---> System.UriFormatException: Invalid URI: The hostname could not be parsed. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.Uri..ctor(String uriString, UriKind uriKind) at System.Net.Http.HttpClient.CreateUri(String uri) at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.<GetDocumentAsync>d__8.MoveNext() --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.<GetDocumentAsync>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.<GetAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.IdentityModel.Protocols.ConfigurationManager1.<GetConfigurationAsync>d__24.MoveNext() --- End of inner exception stack trace --- at Microsoft.IdentityModel.Protocols.ConfigurationManager1.<GetConfigurationAsync>d__24.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.<HandleAuthenticateAsync>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.<HandleAuthenticateAsync>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationHandler1.<InitializeAsync>d__52.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationMiddleware.<Invoke>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at IdentityServer4.Hosting.IdentityServerMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at IdentityServer4.Hosting.FederatedSignOutMiddleware.<Invoke>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at IdentityServer4.Hosting.AuthenticationMiddleware.<Invoke>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.<Invoke>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at IdentityServer4.Hosting.BaseUrlMiddleware.<Invoke>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware1.<Invoke>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.<Invoke>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.<Invoke>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.

Answer

The client side and host side are all in Azure. The CORS is set "*" on Azure. Otherwise it will get CORS error.

Answer

I have tried all kinds of CORS setting, still have no luck. Do I set the ServerRootAddress or ClientRootAddress incorrectly?

Answer

Solved Now!

  1. The host side does NOT need any {tenancy_name} in the ServerRootAddress or ClientRootAddress.

  2. Not sure about other templates, but in the .Net core & Angular - NetFrameWork-4.6 , the multi-tenancy does not check the sub-domain if there no tenant data in the session. Sounds like a bug in the template.

  3. My solution is adding my own codes to do the sub-domain checking in the login screen if no tenant data in the session and multi-tenancy is enabled.

Now it works, finally!

Answer

Hi @ismcagdas,

The issue was if I clear all the cache and start with a clean environment. Login Demo.xugo.com.au requires the host user id and password and login as host rather then the tenant Demo.

If I login as Demo from the User page in host admin, then Demo.xugo.com.au requires the Demo user id and password.

Basically, it does not check the Tenant name from URL if no cookie of the tenant is found.

See my post #4018 basically you will need to write your own codes to set the tenant id base on the url. The template 4.5.1 missed this part. Not sure if it is the same in 4.6.1

the remoteServiceBaseUrl should have {TENANCY_NAME} as well in the appconfig.json in Angular project

"remoteServiceBaseUrl": "http://{TENANCY_NAME}.api.azurewebsites.net",

And you need to do a bit of coding to check and set the tenant id.

Showing 1 to 10 of 100 entries