Base solution for your next web application

Activities of "kpmg"

Hi,

thank you for the information.

The link is not valid, and i did not find the issue in the git repo.

In Startup.cs in Web.Host project add

services.AddMvc();

after

services.AddControllersWithViews(options =>
            {
                options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
            }).AddNewtonsoftJson();

Start backend. TokenAuth Api should now be generated. Refresh services proxies.

Yes, this is an Angular application. I've sent you the logs so you have a better understanding from what is happening.

There are some CORS issues in these logs, but we were able to resolve them.

@maliming We have some of those labels in our application and I have replaced them now with proper ones. If this helps I will inform you.

@hikalkan It takes about 240 seconds until we get the HTTP 500. If we increase the timeout, the HTTP error gets delayed too

I undid the changes from my last post and adjusted the TenantCustomizationController.cs

[AllowAnonymous]
public async Task GetCustomCss(int? tenantId)

{
var tenant = await _tenantManager.GetByIdAsync(AbpSession.GetTenantId());
if (tenantId.HasValue)
{
tenant = await _tenantManager.GetByIdAsync(tenantId.Value);
}
if (!tenant.CustomCssId.HasValue)
{
return StatusCode((int)HttpStatusCode.NotFound);
}

using (CurrentUnitOfWork.SetTenantId(tenantId.Value))
{
var cssFileObject = await _binaryObjectManager.GetOrNullAsync(tenant.CustomCssId.Value);
if (cssFileObject == null)
{
return StatusCode((int)HttpStatusCode.NotFound);
}
return File(cssFileObject.Bytes, MimeTypeNames.TextCss);
}

}

and the calling URLS in root.module.ts, tenant-settings.component.html and tenant-settings.component.ts

to

tenantCustomCss.setAttribute('href', AppConsts.remoteServiceBaseUrl + '/TenantCustomization/GetCustomCss?tenantId=' + this.appSession.tenant.id);

Now it seems to work.

I finally found the solution! This article here brought me to the right point.

In the angular project in the file root.module.ts I deleted the four lines (I set a comment in the example) and it worked:

`function initializeTenantResources(injector: Injector) { let appSessionService: AppSessionService = injector.get(AppSessionService);

if (appSessionService.tenant && appSessionService.tenant.customCssId) {
    document.head.appendChild(
        DomHelper.createElement('link', [
            {
                key: 'id',
                value: 'TenantCustomCss'
            },
            // { 
            //     key: 'rel',
            //     value: 'stylesheet'
            // },
            {
                key: 'href',
                value: AppConsts.remoteServiceBaseUrl + '/TenantCustomization/GetCustomCss?tenantId=' + appSessionService.tenant.id
            }])
    );
}`

okay fine, but what is the solution and whats about the second error? In the linked post is no solution for these errors described (also not on the github page)

Answer

I've seen that the issue got closed. I still get the error and my custom css won't get applied.

I use the new 6.5 template with angular and .net core 2.2. The error occures if I upload the custom css several times.

I am hosting it on Azure as a Web App. I think the problem is somewhere else. When I restart the Web App and just call the login screen, the following logs are getting created. First I thought it is my Application Insights but the error bellow still occurs even if I disabled Application Insights.

DELETED SOME LOGS FOR READABILITY


DEBUG 2019-02-05 10:22:06,135 [1    ] Abp.Modules.AbpModuleManager             - Loading Abp modules...
DEBUG 2019-02-05 10:22:06,394 [1    ] Abp.Modules.AbpModuleManager             - Found 23 ABP modules in total.
DEBUG 2019-02-05 10:22:06,523 [1    ] Abp.Modules.AbpModuleManager             - 23 modules loaded.
DEBUG 2019-02-05 10:22:27,794 [1    ] cy.SubscriptionExpireEmailNotifierWorker - Start background worker: myappDemo.MultiTenancy.SubscriptionExpireEmailNotifierWorker
FATAL 2019-02-05 10:22:31,570 [1    ] soft.AspNetCore.Hosting.Internal.WebHost - Hosting startup assembly exception
System.InvalidOperationException: Startup assembly Microsoft.AspNetCore.AzureAppServices.HostingStartup failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
   --- End of inner exception stack trace ---**
   INFO  2019-02-05 10:22:32,477 [8    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS http://myapp-dev7854.azurewebsites.net/AbpUserConfiguration/GetAll?d=1549362115780  
INFO  2019-02-05 10:22:32,635 [8    ] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.
INFO  2019-02-05 10:22:32,861 [8    ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 366.8468ms 204 
INFO  2019-02-05 10:22:33,049 [8    ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://myapp-dev7854.azurewebsites.net/AbpUserConfiguration/GetAll?d=1549362115780 application/json 
INFO  2019-02-05 10:22:33,052 [8    ] pNetCore.Cors.Infrastructure.CorsService - CORS policy execution successful.

DELETED SOME LOGS FOR READABILITY


 INFO  2019-02-05 10:22:40,671 [11   ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://myapp-dev7854.azurewebsites.net/TenantCustomization/GetTenantLogo?skin=light&tenantId=3&id=7ac9b5b4-c56d-c92e-91a3-39eb92117412  
INFO  2019-02-05 10:22:40,789 [11   ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'myappDemo.Web.Controllers.TenantCustomizationController.GetTenantLogo (myappDemo.Web.Core)'
**ERROR 2019-02-05 10:22:40,798 [12   ] 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 myappDemo.Web.Controllers.TenantCustomizationController.GetCustomCss() in C:\DEV\Repos\myapp\aspnet-core\src\myappDemo.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  2019-02-05 10:22:40,817 [12   ] ore.Mvc.Internal.ControllerActionInvoker - Executed action myappDemo.Web.Controllers.TenantCustomizationController.GetCustomCss (myappDemo.Web.Core) in 286.7727ms
INFO  2019-02-05 10:22:40,818 [12   ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'myappDemo.Web.Controllers.TenantCustomizationController.GetCustomCss (myappDemo.Web.Core)'
**ERROR 2019-02-05 10:22:40,825 [12   ] Microsoft.AspNetCore.Server.Kestrel      - Connection id "0HLKBAFB83ATQ", Request id "0HLKBAFB83ATQ:00000005": 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 myappDemo.Web.Controllers.TenantCustomizationController.GetCustomCss() in C:\DEV\Repos\myapp\aspnet-core\src\myappDemo.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.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.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.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.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)
   
Answer

Hi @maliming! Unfortunately I can't send you the source code of the project. Basically, it is the 6.4 template with 6 entities generated by RAD. I changed nothing else in the project. Best wishes and thanks in advance!

Answer

No subdomains at all.

Answer

I can see that the request headers are different to your call.

Showing 1 to 10 of 25 entries