Hi, I want to migrate to 11.4 - just seen that .Application.Shared project is still on <TargetFramework>netstandard2.0</TargetFramework> - is there any reason for that ehy it is not on 6.0?
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
Hi, we are wondering - due to some perfromance issues, to test implemtation of Per Request Redis Cache (got the tipp from other ASPZERO customer): https://aspnetboilerplate.com/Pages/Documents/PerRequestRedisCache
Any hints are welcome - thanks!
Thanks @sedulen :)
We have added this to hist project <myProjectname>.Web.Host.csproj
<Target Name="PrepublishScript" BeforeTargets="ComputeFilesToPublish"> <Exec Command="gulp build" /> <Exec Command="node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod --aot --outputHashing=all" />
Any other ideas?
Hi @sedulen that would be cool - thx in advance !
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
Hi, we have problem that after deployment of new version - we see "new version", but still some functionality not working. After clearing browser cache "manually" - it works (or in incocnito mode).
Is there any possiblity to show some Popup window after new version is published "New version .... Press OK" and when pressing OK button, the browser cache is deleted? Or do you have some other hints?
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
Hi, is there any documentation for the setup of Health Check feature? we want to use this for our application. Thanks!
############################################################################
Complete startup:
############################################################################
public class Startup
{
private const string DefaultCorsPolicyName = "localhost";
private readonly IConfigurationRoot _appConfiguration;
private readonly IWebHostEnvironment _hostingEnvironment;
public Startup(IWebHostEnvironment env)
{
_hostingEnvironment = env;
_appConfiguration = env.GetAppConfiguration();
}
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// Add SAML SSO services.
services.AddSaml(_appConfiguration.GetSection("SAML"));
// In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "wwwroot/dist";
});
//MVC
services.AddControllersWithViews(options =>
{
options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
}).AddNewtonsoftJson();
services.AddSignalR(options => { options.EnableDetailedErrors = true; });
//Configure CORS for angular2 UI
services.AddCors(options =>
{
var corsOrigin = _appConfiguration["App:CorsOrigins"]
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray();
options.AddPolicy(DefaultCorsPolicyName, builder =>
{
//App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
builder
.WithOrigins(
// App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
corsOrigin
)
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
services.AddCors(options =>
{
options.AddPolicy("AllowAllOrigins", builder =>
{
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
});
services.AddControllers();
var isAttendanceFeatureAvailable = bool.Parse(_appConfiguration["App:IsAccessControlFeatureAvailable"]);
IdentityRegistrar.Register(services);
AuthConfigurer.Configure(services, _appConfiguration);
if (isAttendanceFeatureAvailable)
{
services.AddSingleton<RabbitMQPersistentConnection>(sp =>
{
var logger = sp.GetRequiredService<ILogger<RabbitMQPersistentConnection>>();
var factory = new ConnectionFactory()
{
HostName = _appConfiguration["EventBusConnection"]
};
if (!string.IsNullOrEmpty(_appConfiguration["EventBusUserName"]))
{
factory.UserName = _appConfiguration["EventBusUserName"];
}
if (!string.IsNullOrEmpty(_appConfiguration["EventBusPassword"]))
{
factory.Password = _appConfiguration["EventBusPassword"];
}
if (!string.IsNullOrEmpty(_appConfiguration["EventBusPassword"]))
{
factory.Ssl.ServerName = _appConfiguration["EventBusConnection"];
}
if (!string.IsNullOrEmpty(_appConfiguration["EventBusPassword"]))
{
factory.Ssl.Enabled = true;
}
var url = _appConfiguration["NotificationUrl"];
return new RabbitMQPersistentConnection(factory, url);
});
}
//Identity server
if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
{
IdentityServerRegistrar.Register(services, _appConfiguration, options =>
options.UserInteraction = new UserInteractionOptions()
{
LoginUrl = "/UI/Login",
LogoutUrl = "/UI/LogOut",
ErrorUrl = "/Error"
});
}
if (WebConsts.SwaggerUiEnabled)
{
//Swagger - Enable this line and the related lines in Configure method to enable swagger UI
services.AddSwaggerGen(options =>
{
options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
options.SwaggerDoc("v1", new OpenApiInfo() { Title = "WFMOne API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.ParameterFilter<SwaggerEnumParameterFilter>();
options.SchemaFilter<SwaggerEnumSchemaFilter>();
options.OperationFilter<SwaggerOperationIdFilter>();
options.OperationFilter<SwaggerOperationFilter>();
options.CustomSchemaIds(type => type.FullName);
options.CustomDefaultSchemaIdSelector();
}).AddSwaggerGenNewtonsoftSupport();
}
//Recaptcha
services.AddRecaptcha(new RecaptchaOptions
{
SiteKey = _appConfiguration["Recaptcha:SiteKey"],
SecretKey = _appConfiguration["Recaptcha:SecretKey"]
});
if (WebConsts.HangfireDashboardEnabled)
{
//Hangfire(Enable to use Hangfire instead of default job manager)
services.AddHangfire(config =>
{
config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default"));
});
}
if (WebConsts.GraphQL.Enabled)
{
services.AddAndConfigureGraphQL();
}
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
{
services.AddAbpZeroHealthCheck();
var healthCheckUISection = _appConfiguration.GetSection("HealthChecks")?.GetSection("HealthChecksUI");
if (bool.Parse(healthCheckUISection["HealthChecksUIEnabled"]))
{
services.Configure<HealthChecksUISettings>(settings =>
{
healthCheckUISection.Bind(settings, c => c.BindNonPublicProperties = true);
});
services.AddHealthChecksUI();
}
}
//Configure Abp and Dependency Injection
return services.AddAbp<WFMOneWebHostModule>(options =>
{
//Configure Log4Net logging
options.IocManager.IocContainer.AddFacility<LoggingFacility>(
f => f.UseAbpLog4Net().WithConfig(_hostingEnvironment.IsDevelopment()
? "log4net.config"
: "log4net.Production.config")
);
options.PlugInSources.AddFolder(Path.Combine(_hostingEnvironment.WebRootPath, "Plugins"), SearchOption.AllDirectories);
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseStatusCodePagesWithRedirects("~/Error?statusCode={0}");
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
Bold.Licensing.BoldLicenseProvider.RegisterLicense("KbGuIWrFfeANDDqWuWDs5zYZuVLojmxIxYWupqW3Vg0=");
ReportConfig.DefaultSettings = new ReportSettings().RegisterExtensions(new List<string> { "BoldReports.Data.WebData" });
app.UseSpaStaticFiles();
//Initializes ABP framework.
app.UseAbp(options =>
{
options.UseAbpRequestLocalization = false; //used below: UseAbpRequestLocalization
});
app.Use(async (context, next) =>
{
await next();
if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) { context.Request.Path = "/index.html"; await next(); }
});
app.UseStaticFiles();
app.UseRouting();
app.UseCors(DefaultCorsPolicyName); //Enable CORS!
// app.UseCors("AllowAllOrigins");
app.UseAuthentication();
app.UseJwtTokenMiddleware();
var isAttendanceFeatureAvailable = bool.Parse(_appConfiguration["App:IsAccessControlFeatureAvailable"]);
if (isAttendanceFeatureAvailable)
app.UseRabbitListener();
if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
{
app.UseJwtTokenMiddleware("IdentityBearer");
app.UseIdentityServer();
}
app.UseAuthorization();
using (var scope = app.ApplicationServices.CreateScope())
{
if (scope.ServiceProvider.GetService<DatabaseCheckHelper>().Exist(_appConfiguration["ConnectionStrings:Default"]))
{
app.UseAbpRequestLocalization();
}
}
//using (var scope = app.ApplicationServices.CreateScope())
//{
// if (scope.ServiceProvider.GetService<DatabaseCheckHelper>().IsPocDbExists(_appConfiguration["ConnectionStrings:POCDb"]))
// {
// app.UseAbpRequestLocalization();
// }
//}
if (WebConsts.HangfireDashboardEnabled)
{
//Hangfire dashboard &server(Enable to use Hangfire instead of default job manager)
app.UseHangfireDashboard(WebConsts.HangfireDashboardEndPoint, new DashboardOptions
{
Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
});
app.UseHangfireServer();
}
if (bool.Parse(_appConfiguration["Payment:Stripe:IsActive"]))
{
StripeConfiguration.ApiKey = _appConfiguration["Payment:Stripe:SecretKey"];
}
if (WebConsts.GraphQL.Enabled)
{
app.UseGraphQL<MainSchema>();
if (WebConsts.GraphQL.PlaygroundEnabled)
{
app.UseGraphQLPlayground(
new GraphQLPlaygroundOptions()); //to explorer API navigate https://*DOMAIN*/ui/playground
}
}
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<AbpCommonHub>("/signalr");
endpoints.MapHub<ChatHub>("/signalr-chat");
endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
{
endpoints.MapHealthChecks("/health", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
}
});
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
{
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksUI:HealthChecksUIEnabled"]))
{
app.UseHealthChecksUI();
}
}
if (WebConsts.SwaggerUiEnabled)
{
// Enable middleware to serve generated Swagger as a JSON endpoint
app.UseSwagger();
// Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint(_appConfiguration["App:SwaggerEndPoint"], "WFMOne API V1");
options.IndexStream = () => Assembly.GetExecutingAssembly()
.GetManifestResourceStream("WFMOne.Web.wwwroot.swagger.ui.index.html");
options.InjectBaseUrl(_appConfiguration["App:ServerRootAddress"]);
}); //URL: /swagger
}
}
}
public static class ApplicationBuilderExtentions
{
public static RabbitMQPersistentConnection Listener { get; set; }
public static IApplicationBuilder UseRabbitListener(this IApplicationBuilder app)
{
Listener = app.ApplicationServices.GetService<RabbitMQPersistentConnection>();
var life = app.ApplicationServices.GetService<Microsoft.Extensions.Hosting.IApplicationLifetime>();
life.ApplicationStarted.Register(OnStarted);
//press Ctrl+C to reproduce if your app runs in Kestrel as a console app
life.ApplicationStopping.Register(OnStopping);
return app;
}
private static void OnStarted()
{
Listener.CreateConsumerChannel();
}
private static void OnStopping()
{
Listener.Disconnect();
}
}
Here is my Configure part - below the whole statup class
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseStatusCodePagesWithRedirects("~/Error?statusCode={0}");
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
Bold.Licensing.BoldLicenseProvider.RegisterLicense("KbGuIWrFfeANDDqWuWDs5zYZuVLojmxIxYWupqW3Vg0=");
ReportConfig.DefaultSettings = new ReportSettings().RegisterExtensions(new List<string> { "BoldReports.Data.WebData" });
app.UseSpaStaticFiles();
//Initializes ABP framework.
app.UseAbp(options =>
{
options.UseAbpRequestLocalization = false; //used below: UseAbpRequestLocalization
});
app.Use(async (context, next) =>
{
await next();
if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value)) { context.Request.Path = "/index.html"; await next(); }
});
app.UseStaticFiles();
app.UseRouting();
app.UseCors(DefaultCorsPolicyName); //Enable CORS!
// app.UseCors("AllowAllOrigins");
app.UseAuthentication();
app.UseJwtTokenMiddleware();
var isAttendanceFeatureAvailable = bool.Parse(_appConfiguration["App:IsAccessControlFeatureAvailable"]);
if (isAttendanceFeatureAvailable)
app.UseRabbitListener();
if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
{
app.UseJwtTokenMiddleware("IdentityBearer");
app.UseIdentityServer();
}
app.UseAuthorization();
using (var scope = app.ApplicationServices.CreateScope())
{
if (scope.ServiceProvider.GetService<DatabaseCheckHelper>().Exist(_appConfiguration["ConnectionStrings:Default"]))
{
app.UseAbpRequestLocalization();
}
}
//using (var scope = app.ApplicationServices.CreateScope())
//{
// if (scope.ServiceProvider.GetService<DatabaseCheckHelper>().IsPocDbExists(_appConfiguration["ConnectionStrings:POCDb"]))
// {
// app.UseAbpRequestLocalization();
// }
//}
if (WebConsts.HangfireDashboardEnabled)
{
//Hangfire dashboard &server(Enable to use Hangfire instead of default job manager)
app.UseHangfireDashboard(WebConsts.HangfireDashboardEndPoint, new DashboardOptions
{
Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
});
app.UseHangfireServer();
}
if (bool.Parse(_appConfiguration["Payment:Stripe:IsActive"]))
{
StripeConfiguration.ApiKey = _appConfiguration["Payment:Stripe:SecretKey"];
}
if (WebConsts.GraphQL.Enabled)
{
app.UseGraphQL<MainSchema>();
if (WebConsts.GraphQL.PlaygroundEnabled)
{
app.UseGraphQLPlayground(
new GraphQLPlaygroundOptions()); //to explorer API navigate https://*DOMAIN*/ui/playground
}
}
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<AbpCommonHub>("/signalr");
endpoints.MapHub<ChatHub>("/signalr-chat");
endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
{
endpoints.MapHealthChecks("/health", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
}
});
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
{
if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksUI:HealthChecksUIEnabled"]))
{
app.UseHealthChecksUI();
}
}
if (WebConsts.SwaggerUiEnabled)
{
// Enable middleware to serve generated Swagger as a JSON endpoint
app.UseSwagger();
// Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint(_appConfiguration["App:SwaggerEndPoint"], "WFMOne API V1");
options.IndexStream = () => Assembly.GetExecutingAssembly()
.GetManifestResourceStream("WFMOne.Web.wwwroot.swagger.ui.index.html");
options.InjectBaseUrl(_appConfiguration["App:ServerRootAddress"]);
}); //URL: /swagger
}
}
}
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
Hi, on customer server, we get every few seconds the below error:
"AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID "16573246634629036021", Request ID "8000781f-0001-e600-b63f-84710c7967bb": An unhandled exception was thrown by the application. System.InvalidOperationException: Response already started"
Details here. Any idea what is the reason and how to fix that? Server is IIS, Angular app is separatly hosted in own domain. Also every app - Anglaur and .NET core has own App Pools.
ERROR 2022-03-21 11:13:36,858 [158 ] e.Diagnostics.ExceptionHandlerMiddleware - An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Response already started
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.OnStarting(Func2 callback, Object state) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.EvaluateAndApplyPolicy(HttpContext context, CorsPolicy corsPolicy) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at WFMOne.Web.Startup.Startup.<>c.<<Configure>b__5_1>d.MoveNext() in /home/vsts/work/1/s/src/WFMOne.Web.Host/Startup/Startup.cs:line 277 --- End of stack trace from previous location --- at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) ERROR 2022-03-21 11:13:36,859 [158 ] AspNetCore.Server.IIS.Core.IISHttpServer - Connection ID "16573246634629036021", Request ID "8000781f-0001-e600-b63f-84710c7967bb": An unhandled exception was thrown by the application. System.InvalidOperationException: Response already started at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.OnStarting(Func
2 callback, Object state)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.EvaluateAndApplyPolicy(HttpContext context, CorsPolicy corsPolicy)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at WFMOne.Web.Startup.Startup.<>c.<<Configure>b__5_1>d.MoveNext() in /home/vsts/work/1/s/src/WFMOne.Web.Host/Startup/Startup.cs:line 277
--- End of stack trace from previous location ---
at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT1.ProcessRequestAsync() ERROR 2022-03-21 11:14:14,190 [152 ] e.Diagnostics.ExceptionHandlerMiddleware - An unhandled exception has occurred while executing the request. System.InvalidOperationException: Response already started at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.OnStarting(Func
2 callback, Object state)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.EvaluateAndApplyPolicy(HttpContext context, CorsPolicy corsPolicy)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at WFMOne.Web.Startup.Startup.<>c.<<Configure>b__5_1>d.MoveNext() in /home/vsts/work/1/s/src/WFMOne.Web.Host/Startup/Startup.cs:line 277
--- End of stack trace from previous location ---
at Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)