Questions

ASP.NET 6 + Identity + Sqlite, services.AddDbContext() how?

I am using a tutorial for ASP.NET Core 5.0 + SQL Server, but I am actually using ASP.NET Core 6.0 + Sqlite. The tutorial has the following code in `StartUp.cs` ``` public void ConfigureServices(IServi...

How can I find the Windows product name in Windows 11?

Windows 11, released yesterday, reports itself as Windows 10.0 just about everywhere - `RtlGetVersion` says 10.0, and if you ask `VerifyVersionInfo` if you are 11.0 or greater, it says no. There seems...

.NET 6 XmlSerializer Pretty print

I've this sample .NET 6 program printing out a serialised object to XML: ``` using System.Text; using System.Xml.Serialization; var serializer = new XmlSerializer(typeof(Order)); var order = new Ord...

4 Oct at 19:40

What does a question mark after a reference type mean in C#?

What is the purpose of the question mark after the type of the parameter which is a reference type? e.g one of the constructors for an `OverflowException` contains `string?` and `Exception?` parameter...

15 Jul at 19:48

HttpClient - Request was canceled - Timeout of 100 seconds elapsing

I am using a blazor web assembly project followed by a asp.net core web api and a shared project. When running my two projects and pulling up post man to perform a GET request `https://localhost:5011/...

Request timeout when soap12 is malformated

We use Servicestack 5.9.2 and get the following error in the log file when sending an malformated soap message. The soap request runs in a timeout. What do we have to do, that the request gets a respo...

1 Oct at 09:53

Webpack build failing with ERR_OSSL_EVP_UNSUPPORTED

I'm having an issue with a Webpack build process that suddenly broke, resulting in the following error... ``` <s> [webpack.Progress] 10% building 0/1 entries 0/0 dependencies 0/0 modules node:internal...

18 Aug at 02:28

How to use appsettings.json in Asp.net core 6 Program.cs file

I'm trying to access appsettings.json in my Asp.net core v6 application Program.cs file, but in this version of .Net the Startup class and Program class are merged together and the using and another s...

16 May at 15:15

HttpPost Data in JSV formst

I need to communicate with a service stack web service. It appears to accept form content with jsv values. Is there a way to serialize an object In such a way that this happens automatically? Somethi...

29 Sep at 23:40

SS OrmLite: Ambiguous column name when joining and filtering on the column name

I have two tables (code first) which shares a common column name "Status", which incidentally is used in a Where clause. This results in the error. ``` var q = db.From<Process>() .Where<Process>(p =>...

28 Sep at 12:35

Register ServiceStack.OrmLite in .Net Framework 4.7.2

I have a pretty simple library that implements the .Net Standard 2.0 as I need this library across a mix of frameworks (i.e, .Net Framework 4.7.2 applications). At the most basic level the .Net Standa...

Use SELECT DISTINCT ON with OrmLite

I tried writing this code to use `SELECT DISTINCT ON`: ``` var q = Db.From<WatchedUrlScanResult>(); q.Join<WatchedUrlRecord>() .Where<WatchedUrlRecord>(x => x.TargetDomainR...

26 Sep at 01:8

Need understanding as to why string.StartsWith() is true when it should be false

So I have this file that I download via ftp. The file is just a config file for a system at my company I work for. Once the file is downloaded I open the file and processor the file. Part of the proce...

24 Sep at 13:28

Is it possible to change HTML title with SwashBuckle and Swagger UI

We have many services, which use SwashBuckle / Swagger UI to expose REST methods. It can often be annoying when you have several of them open in tabs in a browser that you cannot immdiately see the se...

5 May at 14:55

ServiceStack Authentication flow

I’m integrating ServiceStack authentication in my own web app. The flow that I’m trying to implementing is 1. Calling Authenticate method of my own AuthProvider 2. If the authentication against authR...

Is it possible to create a C# record with a private constructor?

I´m trying to rebuild a `discriminated union type` in C#. I always created them with classes like this: ``` public abstract class Result { private Result() { } public sealed class Ok : Resul...

23 Jun at 11:33

Using dotnet dev-certs with aspnet docker image

You can use `dotnet dev-certs https` to generate a self-signed certificate for use with ASP.NET as this dockerfile demontrates ``` FROM mcr.microsoft.com/dotnet/sdk:5.0 as build WORKDIR /src RUN dotne...

22 Sep at 10:28

Why is HttpRepl unable to find an OpenAPI description? The command "ls" does not show available endpoints

I am working through the Microsoft Learn tutorials to "[Create a web API with ASP.Net Core](https://learn.microsoft.com/en-us/learn/modules/build-web-api-aspnet-core/3-exercise-create-web-api)". Under...

25 Sep at 02:51

What is the difference between "is not null" and "!= null"?

With the release of C# 9.0, the pattern was introduced. The documentation for [pattern matching](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/patterns) states: > Begin...

22 Feb at 15:54

Autoquery servicestack ILeftJoin issue with table.id column

I have definition of autoquery dto defined as below: ``` [Route("/project/{ProjectId}/contracts/{ContractId}/items")] public class QueryContractItem : QueryDb<ContractItem, ContractItemResponse>, ...

Can OrmLite specify foreign key to an attribute other than the primary key

I have a table structure where a foreign key from Employee table references something other than the primary key of the Department table. This is for historical reasons, so that's just the way it is. ...

Entity Framework | Sequence contains more than one matching element

I used the database first approach. The model is right (or at least it looks like) But I always get this error. Please, I've already tried so many things.. The full code of my program (and even sql sc...

18 Sep at 16:7

Get X509 Certificate WITH PRIVATE KEY from Azure Keyvault c#

I am currently working on an authentication server developed in C #, this one is hosted on an azure function app, and I use a KeyVault where my secrets are stored. My problem is the following, in my k...

5 May at 16:48

MicrosoftGraphAuthProvider does not respect [Authenticate("microsoftgraph")] attribute

We have implemented the MicrosoftGraphAuthProvider and it is all set up correctly as we have added an endpoint to output the authorized user's credentials using the following: ``` if (!IsAuthenticated...

Fetch API cannot load localhost:(port&path). URL scheme "localhost" is not supported

I create react app that use API created with Spring Boot. I would like to send a file to the server via the form in my react app (The server works good because I can upload file in Postman). This is m...

15 Sep at 19:12