Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "kpmg"

Answer

@ismcagdas

everytime I change the site I get the error in the developer console of chrome and also in the server logs.

main.34f03c3c41db8237c873.js:1 GET https://mywebsite.azurewebsites.net//TenantCustomization/GetCustomCss?id=e2a1b0e6-4cc6-0daa-b8e3-39eacdb0338a net::ERR_ABORTED 500 (Internal Server Error)

I also deleted the file and reuploaded it but nothing changed.

Answer

Thanks for the analysis. But why is the tenantId not set or obtained? I used the RAD tool and did no other adjustments.

Answer

Here are the logs. They say I wouldn't be logged in, but I am (logged out and back in to the tenant three times).

I have a host and one tenant, both in one database. I want to change the custom css in the tenant application.

INFO 2018-12-17 10:20:53,134 [6 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://mywebsite-dev.azurewebsites.net/TenantCustomization/GetCustomCss?id=2230994b-89bc-e00d-0adb-39eacda4b09b
INFO 2018-12-17 10:20:53,150 [6 ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "GetCustomCss", controller = "TenantCustomization", area = ""}. Executing action mywebsiteDemo.Web.Controllers.TenantCustomizationController.GetCustomCss (mywebsiteDemo.Web.Core)
INFO 2018-12-17 10:20:53,166 [6 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method mywebsiteDemo.Web.Controllers.TenantCustomizationController.GetCustomCss (mywebsiteDemo.Web.Core) - Validation state: Valid
ERROR 2018-12-17 10:20:53,262 [6 ] Mvc.ExceptionHandling.AbpExceptionFilter - Session.TenantId is null! Possible problems: No user logged in or current logged in user in a host user (TenantId is always null for host users).
Abp.AbpException: Session.TenantId is null! Possible problems: No user logged in or current logged in user in a host user (TenantId is always null for host users).
at Abp.Runtime.Session.AbpSessionExtensions.GetTenantId(IAbpSession session)
at mywebsiteDemo.Web.Controllers.TenantCustomizationController.GetCustomCss() in C:\DEV\ReposNeu\mywebsitetoolNeu\mywebsiteDemo\aspnet-core\src\mywebsiteDemo.Web.Core\Controllers\TenantCustomizationController.cs:line 170
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
INFO 2018-12-17 10:20:53,273 [6 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action mywebsiteDemo.Web.Controllers.TenantCustomizationController.GetCustomCss (mywebsiteDemo.Web.Core) in 121.7508ms
ERROR 2018-12-17 10:20:53,275 [6 ] Microsoft.AspNetCore.Server.Kestrel - Connection id "0HLJ403EJ8DV1", Request id "0HLJ403EJ8DV1:00000004": An unhandled exception was thrown by the application.
Abp.AbpException: Session.TenantId is null! Possible problems: No user logged in or current logged in user in a host user (TenantId is always null for host users).
at Abp.Runtime.Session.AbpSessionExtensions.GetTenantId(IAbpSession session)
at mywebsiteDemo.Web.Controllers.TenantCustomizationController.GetCustomCss() in C:\DEV\ReposNeu\mywebsitetoolNeu\mywebsiteDemo\aspnet-core\src\mywebsiteDemo.Web.Core\Controllers\TenantCustomizationController.cs:line 170
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ExceptionContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)
at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
INFO 2018-12-17 10:20:53,359 [6 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 225.2234ms 500
Answer

In the URL is no "api/serives"? Might this be the problem?

Should it be https://mywebsite__fa76:80/api/services/TenantCustomization/GetCustomCss?id=67c9f746-0aa3-bcdc-241e-39eacd7efde6)?

Answer

I am using the Zero 6.4.0 with Core 2.2 and Angular It's hosted as a App Service on Azure.

HTTP Error 500.0 - Internal Server Error - The page cannot be displayed because an internal server error has occurred.

Most likely causes:

  • IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
  • IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
  • IIS was not able to process configuration for the Web site or application.
  • The authenticated user does not have permission to use this DLL.
  • The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

Detailed Error Information: Module: AspNetCoreModule Notification: ExecuteRequestHandler Handler: aspNetCore

Requested URL: https://mywebsite__fa76:80/TenantCustomization/GetCustomCss?id=67c9f746-0aa3-bcdc-241e-39eacd7efde6 Physical Path:D:\home\site\wwwroot\TenantCustomization\GetCustomCss Logon Method: Anonymous Logon User:Anonymous

The thing is, I am logged into the backend as administrator. I can't find the physical path on the FTP.

If no tenant is selected, the tenant Id is null and the binary object is saved to the master database with tenant Id null. If a tenant is selected the correct tenant Id is set in the corresponding tenant database.

Actually it is not my code but in this case it should not be a problem to set the tenant Id multiple times even if is not necessary.

Hi @ismcagdas!

Thanks for your answer. How does the UI look like if I do not select this option. Do I have then "embedded" editing screens when I selected an entry from the table?

Thanks!

I found an OK-solution for that.

I added all connection strings in the appsettings.json of the migrator project and adjusted the Main() function a little bit. So the user can choose between the different connection strings. it makes it much easier to update or create different environments.

Here is the code after the bootstrapper.Initialize();

using (var test = bootstrapper.IocManager.ResolveAsDisposable<TestMigratorModule>())
                using (var log = bootstrapper.IocManager.ResolveAsDisposable<Log>())
                {
                    var databases = test.Object.GetEnviroments();

                    string command = String.Empty;
                    while (!command.IsIn("E", "e"))
                    {
                        int i = 0;
                        Console.WriteLine("ID\t\tConnection Key");
                        foreach (var kv in databases)
                        {
                            Console.WriteLine(i + "\t\t" + kv.Key);
                            i++;
                        }

                        log.Object.Write("Type in the ID of the database you want to connect to OR e for Exit: ");
                        command = Console.ReadLine();
                        int result = -1;

                        if (int.TryParse(command, out result))
                        {
                            if (result >= databases.Count || result < 0)
                            {
                                log.Object.Write("The ID you entered does not exist. Try again.");
                            }
                            else
                            {
                                test.Object.SetEnvironment(databases[result].Key);

                                using (var migrateExecuter = bootstrapper.IocManager.ResolveAsDisposable<MultiTenantMigrateExecuter>())
                                {
                                    migrateExecuter.Object.Run(_skipConnVerification);
                                    log.Object.Write("Migration of "+ databases[result].Key+ " ended.");
                                }
                            }
                        }
                    }
                }

And then the new functions in the TestMigratorModule.cs look like this:

public List<KeyValuePair<string, string>> GetEnviroments()
        {
            string connectionStringSection = "ConnectionStrings";
            List<KeyValuePair<string, string>> ret = new List<KeyValuePair<string, string>>();
            foreach (var kv in _appConfiguration.GetSection(connectionStringSection).AsEnumerable())
            {
                string cleanKey = string.Empty;
                if (!string.IsNullOrEmpty(kv.Value))
                {
                    cleanKey = kv.Key.Substring(connectionStringSection.Length + 1);
                    ret.Add(new KeyValuePair<string, string>(cleanKey, kv.Value));
                }
            }
            return ret;
        }

        public void SetEnvironment(string environment)
        {
            Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString(
                environment
                );
        }

Perhaps this helps someone.

Hi Aaron!

Thank you for you answer. I changed all the targetframework attributes and it almost worked out. The problem was SignalR that I had to also adjust to the .Net Core template.

So I adjusted a bunch of classes that I fortunately did not change since the project start. But now after all the changes I stuck during the startup on an error:

‘MyProject.Web.Chat.SignalR.SignalRChatCommunicator' is waiting for the following dependencies:

  • Service 'Microsoft.AspNetCore.SignalR.IHubContext`1[[MyProject.Web.Chat.SignalR.ChatHub, MyProject.Web.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.’ Do you know where I can register the IHubContext? I could not find the place in a blank .Net Core project where that is done.

Thanks a lot!

thank you,

i e-mailed my development manager to add me to this list. when i have access i will have a look at the linked issue

best regards

Showing 11 to 20 of 25 entries