asp.net-core-3.1

Group join in EF Core 3.1

冷暖自知 提交于 2020-08-19 07:29:29
问题 I am trying to group join in EF core 3.1 the problem it returns Processing of the LINQ expression 'DbSet failed. This may indicate either a bug or a limitation in EF Core my code is like this var employees = await (from enrollment in RepositoryContext.Enrollments join allowance in RepositoryContext.Allowances.Include(y=>y.AllowanceType) on enrollment.EmployeeId equals allowance.EmployeeId into allowances select new { enrollment, allowances } ).AsNoTracking().ToListAsync(); the allowances is

Unable to Load Assembly in Worker Service (.Net Core3.1 and NLog 4.9.2)

≡放荡痞女 提交于 2020-08-10 20:22:22
问题 This is a repeated question but don't know what happens in this solution scenario , We are setting up an WorkerService in .Net core 3.1 . For logging we are using NLog . While building we were getting the error: System.IO.FileNotFoundException: 'Could not load file or assembly 'NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c'. The system cannot find the file specified.' This error occues in Project.cs(shown in code below). The ServiceFileLogger belongs to another

“Role” Claim is missing from the token - NET CORE 3.1 & IS4

心不动则不痛 提交于 2020-08-10 19:23:17
问题 I have a service which is responsible for authenticating users. After updating: IdentityServer4 from 2.3.2 to 4.0.2; an issue popped up: The token does not contain the required user claims anymore. The service is configured this way: The Startup.cs contains: applicationBuilder.UseCookiePolicy(); applicationBuilder.UseIdentityServer(); applicationBuilder.UseAuthorization(); //... mvcCoreBuilder.AddAuthorization(ConfigureAuthorization); var auth = mvcCoreBuilder.Services.AddAuthentication

how to handle exception for IHostBuilder CreateHostBuilder

廉价感情. 提交于 2020-08-09 08:14:51
问题 To simulate the error, I gave the wrong azure key vault address. With the below code; I tried all the possible ways to try/catch the exception, but still I get an error when the app is start. How do I handle this exception so the application does NOT throw the error during startup? I have ASP.NET Core 3.1 web API application. HTTP Error 500.30 - ANCM In-Process Start Failure The actual reason for the error is that I put wrong key vault address, System.Net.Http.HttpRequestException: 'No such

How to modify the current culture date format in Blazor (server)?

落花浮王杯 提交于 2020-08-02 06:51:07
问题 ASP.NET Core Blazor globalization and localization states: Blazor's @bind functionality performs formats and parses values for display based on the user's current culture. The current culture can be accessed from the System.Globalization.CultureInfo.CurrentCulture property . The statement is true, but the problem is that, the culture has to be set just before it is used (or maybe each time the DOM is refreshed). For demonstration I will use standard blazor counter application. Let's modify

CORS header not being set for internal server error response ASP.NET Core 3.1

僤鯓⒐⒋嵵緔 提交于 2020-07-31 04:15:25
问题 Here is my CORS configuration: services.AddCors(options => { options.AddPolicy(name: "AllowedOrigins", policyBuilder => { var urls = Configuration.GetSection("Host:AllowedOrigins").Get<List<string>>(); policyBuilder.WithOrigins(urls.ToArray()) .AllowAnyMethod() .AllowAnyHeader() .SetIsOriginAllowed((host) => true) .AllowCredentials(); }); }); And in Configure method: app.UseRouting(); app.UseCors("AllowedOrigins"); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints =>

how to read certificate if web app is hosted over azure app service

老子叫甜甜 提交于 2020-07-28 04:56:00
问题 I have a asp.net core web api (app1) application which is calling another asp.net core web api (app2) and I am considering app1 as deamon app and I would like to follow client credentials with certificate rather than application secrets. https://github.com/Azure-Samples/active-directory-dotnetcore-daemon-v2/tree/master/2-Call-OwnApi#variation-daemon-application-using-client-credentials-with-certificates Everything works fine till my both app1 and app2 running in local machine where I am