Create a Linux-based Docker file for .NET Framework project
I have an ASP.Net Framework 4.8 project. I want to create a Linux-based Docker file for this project, but I can't find a Linux-based image to use as a base image in my Docker file for .NET Framework. ...
- Modified
- 27 Jan at 14:37
error CS8773: "Feature 'global using directive' is not available in C# 9.0" after downgrade from net6.0 to net5.0
I have a project that was initially created for .NET 6 but then I needed to downgrade it to .NET 5. I changed Target framework in Project Properties and tried to compile. As a result I received a bunc...
- Modified
- 15 Jan at 14:59
.NET Maui Get screen Y and X
I cant seem to find how to get the screen size of the screen. I tried the Xamarin forms way: ```csharp mainDisplayInfo.Height; ``` Maui for windows doesnt work like this, anyone know how I ca...
MediatR IPipelineBehavior<TRequest, TResponse> errors as The type 'TRequest' cannot be used as type parameter 'TRequest' in the generic type or method
I'm using `MediatR` to do Request - Response logging in my application using `IPipelineBehavior<TRequest, TResponse>` ``` internal sealed class AppLoggingBehavior<TRequest, TResponse> : IPipelineBeha...
SQL Server Pre-Login Handshake (error: 31 - Encryption(ssl/tls) handshake failed)
I have a SQL serverand the following code in a .NET Core Web Api controller: Locally this code works without issues but when executing in Azure's App service it breaks when opening the connection with...
- Modified
- 7 May at 05:39
How to say Datetime - timestamp without time zone in EF Core 6.0
I migrate an ASP.NET Core project from 3.1 to 6.0. I have copied old migration and pasted it to our new version Migration on EF Core 3.1 (old) ``` migrationBuilder.AddColumn<DateTime>( ...
- Modified
- 9 Jan at 17:42
.NET Core 6 - How to get an ILogger instance without Dependency Injection in Program.cs during Startup
I've updated the content of my original question as I was starting to cause some confusion amongst the people trying to help me. I am using the library "Microsoft.ApplicationInsights.AspNetCore" to se...
- Modified
- 3 Jun at 16:18
Is it possible to use Entity Framework Core 6 with MongoDb?
Is it possible to use EF Core 6 in combination with a MongoDb? From what I'v gathered online, I could only find answers from a few years ago that say that it's still not possible, but nothing that was...
- Modified
- 7 Jan at 08:14
How to create MVC5 web project in visual studio 2022
I just installed Visual Studio 2022 and I wanted to create a .Net Framework standard MVC5 web application project but, surprisingly, no option exists in the visual studio 2022 startup project template...
- Modified
- 7 Jan at 04:18
How To Resolve Error: Required properties '{'Prop1', 'Prop2'}' are missing for the instance of entity type 'SomeType''?
: how to resolve this error: > Microsoft.EntityFrameworkCore.DbUpdateException: Required properties '{'Prop1', 'Prop2'}' are missing for the instance of entity type 'SomeEntity' with the key value '{I...
- Modified
- 5 Jan at 23:30
Microsoft.AspNetCore.SpaProxy 6.0.1 - ASPNETCORE_HOSTINGSTARTUPASSEMBLIES - System.UriFormatException: Invalid URI: The URI is empty
I get the following error when trying to add `Microsoft.AspNetCore.SpaProxy 6.0.1` NuGet on start: > fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "X", Request id "Y:00000001": An unhand...
- Modified
- 5 Jan at 15:33
How to seed data in .NET Core 6 with Entity Framework?
I know how to seed data to a database with old in `startup.cs` file using my `Seeder` class with a `Seed()` method creating some initial data. ``` public void Configure(IApplicationBuilder app, IHost...
- Modified
- 4 Jan at 16:20
Unauthorized (Invalid Token) when authenticating with JWT Bearer Token after update to .NET 6
After updating the package `Microsoft.AspNetCore.Authentication.JwtBearer` from version 3.1.14 to 6.0.1, requests with authentication fail with 401 Unauthorized "invalid token". What needs to be chang...
- Modified
- 4 Jan at 13:3
Adding Entity Framework Model on Visual Studio 2022
I am using Visual Studio 2022 with.Net 6.0, I installed Entity Framework 6.4.4 after adding it when I create an Entity Framework model. I am getting a Popup message saying that. >The project's target ...
- Modified
- 1 Sep at 10:51
Getting 400 error when running basic auth test on apphost
I have an apphost ``` public class LocalTestAppHost : AppSelfHostBase { public LocalTestAppHost() : base(nameof(LocalTestAppHost), typeof(MyServices).Assembly, typeof(LocalTestAppHost).Ass...
- Modified
- 1 Jan at 19:42
How to enable cors in ASP.NET Core 6.0 Web API project?
Configured CORS in my ASP.NET Core 6.0 Web API project. But the preflight request receives a http 405 error. In other words HTTP OPTION is not allowed. Looks like cors is not enabled. I've seen exampl...
- Modified
- 28 Dec at 19:30
How to use dependency injection in WinForms
How to define dependency injection in Winforms C#? Interface ICategory: ``` public interface ICategory { void Save(); } ``` Class CategoryRepository: ``` public class CategoryRepository : ICatego...
- Modified
- 24 Dec at 22:10
Compiling C# project to WebAssembly
I need to compile a C# project to WebAssembly and be able to call some methods from JavaScript. I want to use it in an old ASP.NET MVC 4 application that needs to add some new features and I prefer to...
- Modified
- 24 Dec at 16:14
Servicestack Test: Method not found: 'Int32 ServiceStack.DataAnnotations.CustomFieldAttribute.get_Order()
Trying to build integration test with connection to db in ServiceStack. My ServiceStack app is working fine, but when I run simple test I got this error message in line:22 There is a lite cod: ``` us...
- Modified
- 21 Dec at 20:41
How to automatically create missing indexes?
``` [Alias("MyTable")] // [References(typeof(MyModelGlobalIndex))] public class MyModel { [HashKey] public new long Id { get; set; } public new long EventId { get; set; } public Meet...
- Modified
- 21 Dec at 18:26
Delete orphans in Servicestack ORMLite with junction/join table
I've got a three table keyword structure Team <- TeamKeyword -> Keyword where the middle table is the junction table (join table). I'd like to remove possible orphans from Keyword (not in use in TeamK...
- Modified
- 21 Dec at 16:19
Unable to find package Swashbuckle.AspNetCore. No packages exist with this id: Visual Studio Offline Packages
I am struggling with a project I just created on Visual Studio 2019. It's a .net C# project. When I launch the project I get this error : "Unable to find package Swashbuckle.AspNetCore. No packa...
How to inject IConfiguration in asp.net core 6
There is no Startup.cs in the web/api application any more. We used to be able to inject `IConfiguration` into that `Startup` class. ``` public class Startup { public Startup(IConfiguration config...
- Modified
- 21 Dec at 15:15
Init-only reference properties with nullable enabled in C# 10.0
I tried to use init-only properties to force client code to initialize my class when they create it, but without a constructor. It's not working as I planned. Here's the class, stripped down to illus...
- Modified
- 20 Dec at 22:38
Why in C# do I get a compiler warning CS8618 on init properties
I have this code With the following compiler warning: > [CS8618] Non-nullable property 'SomeProperty' must contain a non-null value when exiting constructor. Consider declaring the property as nullabl...
- Modified
- 6 May at 20:25