Questions

Using 'UseMvc' to configure MVC is not supported while using Endpoint Routing

I had an Asp.Net core 2.2 project. Recently, I changed the version from .net core 2.2 to .net core 3.0 Preview 8. After this change I see this warning message: > using 'UseMvc' to configure MVC is...

Net Core API: Purpose of ProducesResponseType

I want to understand the purpose of `ProducesResponseType.` Microsoft defines as `a filter that specifies the type of the value and status code returned by the action.` So I am curious what are conseq...

17 Aug at 12:53

Unexpected character encountered while parsing value: . Path '', line 1, position 1

I've created an out of the box .NET Core 2.2 solution and run it. As in: 1. Create Project, selecting ASP.NET Core Web Application. 2. Select API as the project template. 3. F5 This gives me thi...

27 Aug at 16:12

How to change default constructor?

ServiceStack generates typescript code based on my backend api classes. Those typescript classes have default constructors, which looks like this. ``` export class ExamleClass { public constructor(i...

27 Aug at 14:17

VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system

I design websites in VSC and PowerShell is my default terminal. After updating and deploying a website to firebase earlier, I was prompted to update firebase tools - which I did using npm. Immediatel...

dotnet restore incredibly slow inside docker-compose build

I have a .NET Core project that I'm building into a docker image. The Dockerfile looks like this: ``` FROM mcr.microsoft.com/dotnet/core/sdk:3.0-alpine AS restore WORKDIR /tmp/build COPY ./*.sln . CO...

27 Aug at 07:15

AddNewtonsoftJson is not overriding System.Text.Json

I have upgraded my version of .Net Core from preview 2 to preview 6 which has broken a couple of things. Most significant is that I cannot use newtonsoft JSON anymore. AddNewtonsoftJson in ConfigureS...

Calling WEB API with basic authentication in C#

I have a working WEB API that I wrote, and I added basic authentication to the API (username is "testing", password is "123456"). However, when trying to call that API from my web form, I keep getting...

StackExchange.Redis.RedisTimeoutException: Timeout awaiting response

I have a Redis cluster of 6 instances, 3 master and 3 slaves. My ASP .NET Core application uses it as a cache. Sometimes I get such an error: `StackExchange.Redis.RedisTimeoutException: Timeout awaiti...

Does Dbcontext registered as "scoped" or "transient" affect in closing database connection

I have a basic understanding in DI in ASP.NET MVC, but there is a question that bothers me a lot. Does it make any difference to register Dbcontext as 'scoped' or "transient"? Below is some code of a...

23 Feb at 17:57

Manual controller registration in ASP.NET Core dependency injection

I need to override ASP.NET Core's default registration for a certain controller. I've tried the below, but it resolves `MyController` from the automatic registration. ``` services.AddTransient((prov...

25 Aug at 15:39

.NET Core EF, cleaning up SqlConnection.CreateCommand

I am using .NET Core DI to get `DbContext` and in my logic I need to execute raw SQL commands also on DB, so for that purpose I am creating `DbCommand` to execute SQL like this(just an example query, ...

BirthDate and BirthDateRaw not set on user registration

I have a form that handles user registration by sending data to the default route of `~/api/register`, but it doesn't work for BirthDate and neither for BirthDateRaw (mapped respectively as `DateTime?...

Blazor: Adding a custom AuthenticationStateProvider in Startup.cs not recognized

I am trying to implement a login using a custom database. As far as I can tell, I need to override AuthenticationStateProvider in order to accomplish this. In MyServerAuthenticationStateProvider.cs: ...

24 Aug at 16:8

The JSON value could not be converted to System.Int32

I want to send data of object to my Web API. The API accepts a parameter of class, which properties are type of int and string. This is my class: ``` public class deneme { public int ID { get; set;...

26 Aug at 16:5

Unable to merge 2 PDFs using MemoryStream

I have a c# class that takes an HTML and converts it to PDF using wkhtmltopdf. As you will see below, I am generating 3 PDFs - Landscape, Portrait, and combined of the two. The `properties` object con...

23 Aug at 13:17

IOptions binding with non-matching property names

Is is possible to bind properties from a JSON file (appsettings.json) to a class that uses different property names? I want to take the `WebURL` setting and map it to the `Url` property in the option...

6 May at 06:5

Integration testing .NET Code 2.2 IHostBuilder (Generic Host Builder)

I am using .NET Core 2.2 IHostBuilder (Generic Host Builder) to build a console app running message streaming app as a BackgroundService (IHostedService). [https://learn.microsoft.com/en-us/aspnet/co...

25 Aug at 23:54

Rounding of last digit changes after Windows .NET update

After Windows has updated, some calculated values have changed in the last digit, e.g. from -0.0776529085243926 to -0.0776529085243925. The change is always down by one and both even and odd numbers a...

21 Aug at 17:57

Why ASP Net Core 2.2 do not release memory?

I'm testing ASP Net Core 2.2 using default project made from: Visual Studio > File > New > Project > ASP NET Core Web Application > Next > Create. Press button on interface and automatically go to [...

.Net Core SignalR cannot add or use in startup

Ive recently come back to an old .Net Core application which was using SignalR. I think at the time the only SignalR NuGet package available for .Net Core applications was a preview. And it worked. ...

21 Aug at 12:13

IIS 10 ServiceStack .Net4.8 404

I recently upgraded to .Net Framework 4.8 and ServiceStack 5.6.0 on one of my projects. When I run it in Visual Studio through IIS express it works fine, but in IIS I get the following. HTTP Error 40...

22 Aug at 02:13

VS 2015 to 2017 migrate to package reference failed

I've inherited a VS-2015 C# application and would like to migrate it to VS 2017 or 2019. It has a packages.config file with 4 packages: ``` <package id="AjaxControlToolkit" version="15.1.4.0" targetF...

4 Feb at 12:35

UWP - No certificate found with the supplied thumbprint

I have a UWP app I work on from two difference devices. After the latest Visual Studio 2019 update I began receiving this error: > No certificate found with the supplied thumbprint: xxxxxxxxxxxxxxxx...

20 Aug at 16:51

ENC1003 C# Changes made in project will not be applied while the application is running

I am getting this incredibly annoying warning for every C# file in my ASP.NET Core project when I debug it after hitting F5: [](https://i.stack.imgur.com/hn52G.png) Because this error appears only d...