Category: .net core
-
Failed to load the development https certificate using docker and ocelot
Hey everyone, I randomly started encountering the following error while using docker to host my Ocelot gateway: Failed to load the development https certificate at ‘/root/.aspnet/https/ContentGateway.pfx’. The solution ended up being to clean out as many temp files as possible, especially the generated certs: Delete the following files: Delete the C:\Users{USER}\AppData\Roaming\ASP.NET\Https folder Clean the solution.…
-
Element does not match nay field or property of Class – MongoDb and .net core
Hey everyone, I ran into the following error today while searching MongoDb for an object: Element ‘Tags’ does not match any field or property of class X. The issue was that there were extra fields on the returned document that were not specified on the mapping target object. A bit of Googling revealed that there…
-
.Net Core Web Api Returning Binary File with No Headers Instead of Expected Response
Hey everyone, A small issue I’ve run into while setting up a .net core web api microservice that also utilises a number of gRPC services. Symptoms were as follows: Response Read via Fiddler – HTTP/1.0 200 This buggy server did not return headers – Value was binary and unable to be read Server logs 03:59:23…
-
Unable to find the target operating system for the project
Hi everyone, I ran into the following error today after updating visual studio 2019 to version 16.6: unable to find the target operating system for the project I tried a fair few things to get this going again and I’m assuming they’re not all necessary, but I’ll list them just in case: – Clean solution…
-
OpenXml Validation Spreadsheet Value Between Two Numbers – C#
Hi everyone, Just a quick post on how to validate a numeric cell to ensure that the value is between two numbers when using OpenXml: // Restrict min and max values var dataValidations = new DocumentFormat.OpenXml.Spreadsheet.DataValidations { Count = 0 }; DocumentFormat.OpenXml.Spreadsheet.DataValidation dataValidation; dataValidation = new DocumentFormat.OpenXml.Spreadsheet.DataValidation { Type = DataValidationValues.Decimal, AllowBlank = false, SequenceOfReferences…
-
“protobuf” visual studio a namespace cannot directly contain members such as fields or methods
Hi everyone, I ran into the following intellisense error while adding a new proto file: “protobuf” visual studio a namespace cannot directly contain members such as fields or methods This was one of many errors that were shown and appeared to be an issue with Intellisense mistaking the file for a normal class definition. The…
-
Docker – Severity Code Description Project File Line Suppression State Error DT1001 Service service has neither an image nor a build context specified. At least one must be provided. docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 204
Hi everyone, I ran into the following error while using docker compose and visual studio: Severity Code Description Project File Line Suppression State Error DT1001 Service has neither an image nor a build context specified. At least one must be provided. docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 204 It took a bit of poking around…
-
Automapper protobuf datetime to timestamp c#
Hi everyone, I ran into the following error tonight while attempting to use automapper to map a datetime field to a protobuf timestamp property: automapper missing type map “DateTime -> Timestamp” To fix it, add the following to your mapping profile: CreateMap().ConvertUsing(x => x.ToTimestamp()); UPDATE: I later hit a similar error parsing a different entity:…
-
Http gRPC with .NET Core and Docker – Error starting gRPC call. System.Net.Http.HttpRequestException: An error occurred while sending the request. —> System.IO.IOException: The response ended prematurely.
Hi everyone, I’ve been mucking around with gRPC today while using .NET Core and Docker. I have two Microservices in the setup, one server and one client. Because these services will only be communicating internally I intended to use HTTP instead of HTTPS. Unfortunately, I hit the following error while attempting to set this up:…
-
eShopOnContainers – No parameterless constructor defined for type dbcontext
Hi everyone, Another eShopOnContainers post. Today I was setting up migrations and ran into the following error: Found DbContext ‘CatalogContext’. Microsoft.EntityFrameworkCore.Design.OperationException: Unable to create an object of type ‘CatalogContext’. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728 —> System.MissingMethodException: No parameterless constructor defined for type ‘Catalog.Api.Infrastructure.CatalogContext’. at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)…