Is Kestrel using a single thread for processing requests like Node.js?

Updated for ASP.Net Core 2.0. As pointed by poke, the server has been split between hosting and transport, where libuv belongs to the transport layer. The libuv ThreadCount has been moved to its own LibuvTransportOptions and they are set separately in your web host builder with the UseLibuv() ext method: If you check the LibuvTransportOptions … Read more

Entity Framework Core: DbContextOptionsBuilder does not contain a definition for ‘usesqlserver’ and no extension method ‘usesqlserver’

First we install the Microsoft.EntityFrameworkCore.SqlServer NuGet Package: PM > Install-Package Microsoft.EntityFrameworkCore.SqlServer Then, after importing the namespace with using Microsoft.EntityFrameworkCore; we add the database context: services.AddDbContext<AspDbContext>(options => options.UseSqlServer(config.GetConnectionString(“optimumDB”)));

.Net Core on Raspberry Pi 4 with Raspbian?

Download .Net Core 3.1 SDK from HERE Make Directory: sudo mkdir /usr/share/dotnet/ PATH to environment: export PATH=$PATH:/usr/share/dotnet/dotnet export DOTNET_ROOT=/usr/share/dotnet/dotnet or just a symlink sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet Copy by Extracting: sudo tar zxf dotnet-sdk-3.1.100-linux-arm.tar.gz -C /usr/share/dotnet/ Confirm Installation: dotnet –info you can find in detail from Here

Get Current User in a Blazor component

There are three possibilities for getting the user in a component (a page is a component): Inject IHttpContextAccessor and from it access HttpContext and then User; need to register IHttpContextAccessor in Startup.ConfigureServices, normally using AddHttpContextAccessor. Edit: according to the Microsoft docs you must not do this for security reasons. Inject an AuthenticationStateProvider property, call GetAuthenticationStateAsync … Read more

OData Support in ASP.net core

Edit: now available at https://www.nuget.org/packages/Microsoft.OData.Core/ It’s in the road map, OData Lib has released 7.0.0 which is a breaking change release, OData/WebAPI will release 6.0.0 based on this, after the release, we will consider to support ASP.NET Core. Relative issue: https://github.com/OData/WebApi/issues/772

AddDbContext or AddDbContextPool

The answer is here (under “DbContext pooling”): https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-2.0#dbcontext-pooling DbContext is not thread-safe. So you cannot reuse the same DbContext object for multiple queries at the same time (weird things happen). The usual solution for this has been to just create a new DbContext object each time you need one. That’s what AddDbContext does. However, there … Read more

Is it possible to self-host an ASP.NET Core Application without IIS?

Is it possible to self-host an ASP.NET Core Application without IIS? Yes. In fact, all ASP.NET Core applications are self-hosted. Even in production, IIS/Nginx/Apache are a reverse proxy for the self-hosted application. In a reasonably standard Program.cs class, you can see the self-hosting. The IISIntegration is optional – it’s only necessary if you want to … Read more