How to have different log types using Serilog and ElasticSearch
I am currently trying to change our system configuration to work with **Serilog** (*instead of working with FileBeat as a shipper to LogStash*) We are also working with the log **type** field (which i...
- Modified
- 18 Jul at 07:43
Create X509Certificate2 from PEM file in .NET Core
I want to create a X509Certificate2 object based on a PEM file. The problem is setting the PrivateKey property of X509Certificate2. I read [X509Certificate2.CreateFromCertFile() on .NET Core](https://...
- Modified
- 9 May at 16:48
Securing a SPA by authorization server before first load
I am using the 'new' project templates for angular SPA applications in dotnet core 2.1 as written in the article [Use the Angular project template with ASP.NET Core](https://learn.microsoft.com/en-us/...
- Modified
- 8 May at 04:37
How to set up unit tests in Unity and fix missing assembly reference error?
I created the following structure: ``` ├── Assets ├── Scenes ├── Scripts │ └── MyExample.cs ├── Tests │ ├── MyExampleTest.cs │ └── Tests.asmdef ``` Now, when I click on Run All, in the Test R...
- Modified
- 8 May at 18:6
ASPNetCore - Uploading a file through REST
I am using Insomnia for testing an API, but the same happens with Postman. I want to test a file upload, with the following controller: ``` public async Task<IActionResult> Post([FromForm]IFormFile ...
- Modified
- 27 Nov at 19:1
Asp.net Core 2.0 RequestSizeLimit attribute not working
I'm creating a website in Asp.net core 2.0 which allows files to be uploaded. I quickly came across the problem of the `30MB` upload limit and receive a `404` response from the server. Below this li...
- Modified
- 7 May at 19:36
C# 7.3 Enum constraint: Why can't I use the enum keyword?
To constrain a generic type parameter to be of an enum type, I previously constrained them like this, which was the best I could go for constraining type T for enums in pre-C# 7.3: ``` void DoSomethin...
Get Icon from UWP App
I want to extract the icon of an UWP App to build a Explorer like "Open With" menue. With the help of [SHAssocEnumHandlers](https://msdn.microsoft.com/en-us/library/windows/desktop/bb762109(v=vs.85)....
Error-Attempt by method 'X.set_DbConnection(System.Data.Common.DbConnection)' to access method 'Y.get_Settings()' failed
I created a console app and use EntityFramework 6.2 (for connection with MS SQL), MySql.Data 8.0.11 and MySql.Data.Entity 6.10.7 (for connection with MySQL). In this application I want to create a jo...
- Modified
- 7 May at 18:27
Web API 2 - Implementing a PATCH
I currently have a Web API that implements a RESTFul API. The model for my API looks like this: ``` public class Member { public string FirstName { get; set; } public string LastName { get; se...
- Modified
- 10 Feb at 04:52
How to make GET request with a complex object?
I try to make `GET` request via WebApi with complex object. Request is like this: Where `CustomObject` is: How do I compose a valid GET request?
- Modified
- 6 May at 18:45
Process.WaitForExit hangs even without using RedirectStandardError/RedirectStandardOutput
We have a service which starts a process and waits for process to exit when service is stopped/ user of service calls stop (to stop/kill process started by service). Sporadically, `process.waitForExi...
What is the difference between MockBehavior.Loose and MockBehavior.Strict in SimpleStub?
I'm a fresh man in VS Unit Test, and I'm learning to add mock module into my unit test project with the `SampleStub` Framework. And I now meet the trouble in understanding `MockBehavior.Loose` and ...
- Modified
- 3 May at 07:41
Swashbuckle/Swagger + ASP.Net Core: "Failed to load API definition"
I develop an ASP.NET Core 2 application and included Swagger. Everything worked fine until I introduced a method without explicitly defining the HTTP action: ``` public class ErrorController : Control...
- Modified
- 20 Jun at 09:12
Default proxy in .net core 2.0
I saw couple of questions asked about core 2.0 on how to make HttpClient to use default proxy configured on the system. But no where found right answer. Posting this question hoping someone who might ...
- Modified
- 29 May at 07:31
How to validate a JWT token
I'm trying to use JWT tokens. I managed to generate a valid `JWTTokenString` and validated it on the [JWT debugger](https://jwt.io/) but I'm having an impossible time validating the token in .Net. He...
C# how to mock Configuration.GetSection("foo:bar").Get<List<string>>()
I have a list like following in config.json file ` ``` { "foo": { "bar": [ "1", "2", "3" ] } }` ``` I am able to get the list at run-time using ``` Configuration.Get...
- Modified
- 6 May at 16:34
.NET Core IServiceScopeFactory.CreateScope() vs IServiceProvider.CreateScope() extension
My understanding is that when using the built in the dependency injection, a .NET Core console app will require you to create and manage all scopes yourself whereas a ASP.NET Core app will create and ...
- Modified
- 7 May at 07:6
What does "+" mean in reflected FullName and '*' after Member c#
I'm currently dealing with reflection in c#. After: ``` Assembly.LoadFile(@"C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Numerics.Vectors.dll").GetTypes() ``` And i found this:...
- Modified
- 7 May at 16:19
ServiceStack.Text Disposes Input Stream
When deserializing data from a stream ServiceStack.Text closes the input stream. Since there is no issue tracker at Github and their web site refers to SO I post the question here. A call to ``` Jso...
- Modified
- 5 May at 21:49
How to make lazy-loading work with EF Core 2.1.0 and proxies
I have the following models: ``` public class Session { public int SessionID { get; set; } public int UserID { get; set; } public virtual User User { get; set; } } public class User { ...
- Modified
- 4 May at 17:33
Change or rename a column name without losing data with Entity Framework Core 2.0
I realised that I had spelt one of my column headers incorrectly so I changed it in the model and created a new migration to update it into the database. All worked perfectly until I realised that wha...
- Modified
- 4 May at 19:26
How can I resolve ServiceStack Framework/Core conflicts when I am only using the Core version of ServiceStack components
I am using Visual Studio 2017. I have a Framework 4.6.1 console application referencing ServiceStack.Client.Core v5.1.0. It also references four other Standard 2.0 DLL projects in the same solution, a...
- Modified
- 4 May at 17:47
NullReferenceException inside .NET code of SqlConnection.CacheConnectionStringProperties()
I'm facing really strange issue. Given the code below: ``` static void Main() { var c = new System.Data.SqlClient.SqlConnection(); c.ConnectionString = "Data Source=SOME_NAME;Initial Catalog...
- Modified
- 7 May at 08:20
Entity Framework Core connect to MSSQL database over SSH tunnel
I've seen a lot of posts asking similar questions, but none of which solved the issue I have. My setup is as follows: - `127.0.0.1:1433`- `L5000 -> 127.0.0.1:1433` When I enter the server name `127...
- Modified
- 14 May at 09:6