Base solution for your next web application

Activities of "DennisAhlin"

I get this too, I'm using Azure.

Hi! I've been trying to get this to work for a few days now. How am I supposed to configure host and client to be able to use multi tenancy, both in localhost, staging and production servers? Solution is .NET Core + Angular 2. In all environments, when I go localhost:4200/staging.mydomain.com/mydomain.com or default.localhost:4200/default.staging.mydomain.com/default.mydomain.com i get the centered loading spinner and after a while a modal with "An error occured/Error detail not sent by server.". I can't see any failed requests in the Network view in Chrome Developer Tools.

Localhost: Currenty I have configured angular appconfig.json like this:

{
  "remoteServiceBaseUrl": "http://localhost:22742",
  "appBaseUrl": "http://{TENANCY_NAME}.localhost:4200"
}

and .Net appsettings.json like this:

"App": {
    "WebSiteRootAddress": "http://localhost:22742"
  }

Staging: Angular appconfig.json:

{
  "remoteServiceBaseUrl": "http://{TENANCY_NAME}.api.staging.mydomain.com",
  "appBaseUrl": "http://{TENANCY_NAME}.staging.mydomain.com"
}

.Net appsettings.json:

"App": {
    "WebSiteRootAddress": "http://{TENANCY_NAME}.staging.mydomain.com/"
  }

Production: Angular appconfig.json:

{
  "remoteServiceBaseUrl": "http://{TENANCY_NAME}.api.mydomain.com",
  "appBaseUrl": "http://{TENANCY_NAME}.mydomain.com"
}

.Net appsettings.json:

"App": {
    "WebSiteRootAddress": "http://{TENANCY_NAME}.mydomain.com/"
  }

Please help, what am I doing wrong? :geek:

I have now updated to ABP 1.5 and AN0 3.3.0 and trying with this configuration.

Localhost: This works, but when browsing localhost:4200 I get to login without tenant selector and when logged in I am logged in on default tenant. And when browsing default.localhost:4200 i get the same error as before. I assume that default... does not work because I need to configure IIS or hosts file in some way to redirect default.localhost to localhost? How can I do that?

angular appconfig.json:

{
  "remoteServiceBaseUrl": "http://{TENANCY_NAME}.localhost:22742",
  "appBaseUrl": "http://{TENANCY_NAME}.localhost:4200"
}

.Net appsettings.json:

"App": {
    "WebSiteRootAddress": "http://{TENANCY_NAME}.localhost:22742/",
    "CorsOrigins": "http://localhost:4200/, http://default.localhost:4200"
  }

Staging: Now "works" with this configuration. However, when I go to <a class="postlink" href="http://staging.mydomain.com">http://staging.mydomain.com</a> I get the login screen without the tenant selection section and when I log in I get logged in as default. The same behaviour as if I go to <a class="postlink" href="http://default.staging.mydomain.com">http://default.staging.mydomain.com</a> (where it is expected).

angular appconfig.json:

{
  "remoteServiceBaseUrl": "http://{TENANCY_NAME}.api.staging.mydomain.com",
  "appBaseUrl": "http://{TENANCY_NAME}.staging.mydomain.com"
}

.Net appsettings.json:

"App": {
    "WebSiteRootAddress": "http://{TENANCY_NAME}.staging.mydomain.com/",
    "CorsOrigins": "http://staging.mydomain.com/,http://default.staging.mydomain.com/"
  }

It still doesn't work to go to default.localhost:4200, how can I solve that?

In staging, though, suddenly I can only log in as host admin. Even when I go to default.staging.mydomain.com I cannot log in with default tenant admin credentials, only with host admin, and I get logged in as host admin?

Ok, I will try with IIS solution locally.

I did have a bad config value in WebSiteRootAddress. It was http://{TENANCY_NAME}.staging.mydomain.com and I have now changed to http://{TENANCY_NAME}.api.staging.mydomain.com. It did no difference, though. I can't go to any other tenant either, like tenant1.staging.mydomain.com. I get the same error modal there even though the first <a class="postlink" href="http://tenant1.api.staging.mydomain.com/AbpUserConfiguration/GetAll">http://tenant1.api.staging.mydomain.com ... ion/GetAll</a> OPTIONS request gets a 204 response.

Yes, I restarted the app, dropped the entire database, redeployed it and emptied all cache in the host admin interface. Hopefully the setting shouldn't be trailing somewhere.

I can go to all <a class="postlink" href="http://tenant1.api.staging.mydomain.com">http://tenant1.api.staging.mydomain.com</a>, <a class="postlink" href="http://default.api.staging.mydomain.com">http://default.api.staging.mydomain.com</a> and <a class="postlink" href="http://api.staging.mydomain.com">http://api.staging.mydomain.com</a> and see the Swagger interface.

So, for anyone with the same problem. The error was that the App:WebSiteRootAddress had a trailing slash. Also, currently you have to add every subdomain into App:CorsOrigins with trailing slash.

Thank you Zero for very good support!

Hi! For some reason, register tenant doesn't work in my .NET Core solution. Not from Swagger nor angular ui. It does not reach my breakpoint on first line of TenantRegistrationAppService/RegisterTenant method but returns 500 response code. Other endpoints, like Account/Register works as expected.

Here is my swagger post: <a class="postlink" href="https://www.dropbox.com/s/brh6bqpuppo6mde/Sk%C3%A4rmklipp%202017-03-21%2012.30.51.png">https://www.dropbox.com/s/brh6bqpuppo6m ... .30.51.png</a>

Answer

Try right clicking on your projectname.Migrator project and "Start new instance". You should get a command prompt window where it asks you if you want to migrate to the connection string. Check that the Host database is correct and confirm. If the database is wrong, change the Default ConnectionString in Migrator project to the connection you want.

DEBUG 2017-03-21 14:39:51,155 [15 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL3GCTFH9U83" completed keep alive response. INFO 2017-03-21 14:39:51,155 [15 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 12.0115ms 500 INFO 2017-03-21 14:39:55,430 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://api.staging.project.com/api/services/app/TenantRegistration/RegisterTenant">http://api.staging.project.com/api/serv ... sterTenant</a>
DEBUG 2017-03-21 14:39:55,430 [14 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HL3GCTFH9U8A" completed keep alive response. INFO 2017-03-21 14:39:55,430 [14 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 2.478ms 204 INFO 2017-03-21 14:39:55,508 [9 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 POST <a class="postlink" href="http://api.staging.project.com/api/services/app/TenantRegistration/RegisterTenant">http://api.staging.project.com/api/serv ... sterTenant</a> application/json; charset=UTF-8 461 DEBUG 2017-03-21 14:39:55,508 [9 ] NetCore.StaticFiles.StaticFileMiddleware - POST requests are not supported DEBUG 2017-03-21 14:39:55,508 [9 ] osoft.AspNetCore.Routing.Tree.TreeRouter - Request successfully matched the route with name '(null)' and template 'api/services/app/TenantRegistration/RegisterTenant'. DEBUG 2017-03-21 14:39:55,523 [9 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action project.MultiTenancy.TenantRegistrationAppService.RegisterTenant (project.Application) DEBUG 2017-03-21 14:39:55,555 [9 ] Mvc.ModelBinding.Binders.BodyModelBinder - Selected input formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonInputFormatter' for content type 'application/json; charset=UTF-8'. INFO 2017-03-21 14:39:55,555 [9 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method project.MultiTenancy.TenantRegistrationAppService.RegisterTenant (project.Application) with arguments (project.MultiTenancy.Dto.RegisterTenantInput) - ModelState is Valid ERROR 2017-03-21 14:39:55,695 [4 ] Mvc.ExceptionHandling.AbpExceptionFilter - Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' at System.Net.Http.WinHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at PaulMiami.AspNetCore.Mvc.Recaptcha.RecaptchaService.<ValidateResponseAsync>d__16.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 project.Web.Security.Recaptcha.RecaptchaValidator.<ValidateAsync>d__4.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 project.MultiTenancy.TenantRegistrationAppService.<RegisterTenant>d__9.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.Mvc.Internal.ObjectMethodExecutor.<CastToObject>d__40`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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.

Could it be after ABP update?

Showing 1 to 10 of 34 entries