asp.net-core-6.0 Questions

1

I am trying to execute a simple default Graphql app on Visual studio 2022 on .net 6 and 7. When the app is executed from visual studio I get the error "localhost is currently unable to handle ...

5

Solved

I have a really simple ASP.Net WebAPI project created in .Net 6. Given this controller method: [HttpPost] public async Task DoStuff(MyClass input) { // snip } where MyClass looks like this: publi...
Tachymetry asked 4/3, 2022 at 10:40

4

Solved

I followed the documentation of microsoft for Integration testing: https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0#introduction-to-integration-tests In .net...
Interlocutress asked 10/12, 2021 at 4:13

4

Solved

I'm working on an ASP.NET API project where I have multiple controllers, and I want to prepend a common prefix to all the URLs before the controller route. For example, I want all my API endpoints ...
Stroke asked 29/6, 2023 at 14:8

6

Solved

I am trying to debug from WSL2 using my VS 2022 IDE in Windows, but I get the following error: The cwd value does indeed look wrong, but how do I fix it? I am using .netcore 6.0.101, Ubuntu 20.04....

7

Solved

Tested in Postman and works fine. In Browser I get this Error: Access to XMLHttpRequest at 'http://localhost:5081/api/Accounting/GetSales' from origin 'https://localhost:44426' has been blocked by...
Anthropophagite asked 4/1, 2022 at 21:33

5

I am trying to add Autofac to a .Net 6.0 web API. I'm using the latest ASP.NET Core Web API template that generates a single start-up Program.cs file. Installed Autofac versions: Autofac 6.3.0 Auto...
Thebaine asked 28/10, 2021 at 13:27

2

Solved

Here is an example similar to the one on this page. public interface IOperation { string OperationId { get; } } public interface IScopedOperation1 : IOperation { } public interface IScopedOperat...
Bitstock asked 2/11, 2022 at 18:32

2

Solved

I am creating an ASP.NET Core 6 application in which I want to integrate additional areas provided by separate assemblies. I follow the documentation at https://learn.microsoft.com/en-us/aspnet/cor...
Coeval asked 2/3, 2022 at 10:9

3

Solved

Is it possible to access the the IConfiguration in the new ASP.NET Minimal API? I do not see the possibility to do such thing. using Microsoft.AspNetCore.Components; using MudBlazor.Services; var ...
Waikiki asked 7/9, 2021 at 15:16

5

I've migrated a web api application from net core 5 to 6 and changed NewtonSoft serializer by System.Text.Json. In my Startup.cs, I've configured Json serialization with the following code: service...
Schaefer asked 4/1, 2022 at 10:27

2

Solved

I am working on a .Net 6.0 project, and I want to migrate from Newtonsoft.Json to System.Text.Json. So far most is working, except the following: I've got this json: [ { "Key":"Val...
Cordierite asked 22/11, 2021 at 13:31

7

Solved

I'm attempting to connect to my ASP.NET Core Web API application (.NET 6 in Visual Studio 2022 Preview) with SQL Server. And I tried to use the following code to configure the connection string in ...
Sarre asked 30/8, 2021 at 8:6

4

Solved

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.AspNetCor...
Refutation asked 8/1, 2022 at 17:41

8

I create a brand new ASP.NET Core MVC project using VS 2022 and .NET Core 6. VS will generate the base template and when I run it without touching any code, everything is fine. So far so good. Now...
Brutify asked 7/12, 2021 at 9:11

6

Solved

I know how to seed data to a database with old .NET 5.0 in startup.cs file using my Seeder class with a Seed() method creating some initial data. public void Configure(IApplicationBuilder app, IHos...
Dismiss asked 4/1, 2022 at 16:14

2

This question has been asked many times over the last few years, but all answers appear to either: Relate to the route not being found (in this case I refer strictly to data) Require use of the IH...
Melee asked 12/10, 2022 at 14:5

3

Solved

In .Net 5, we use to be able to call the migration by passing DataContext to Configure method and call the migration in startup class. public void Configure(IApplicationBuilder app, IWebHostEnviron...
Gillis asked 7/12, 2021 at 20:18

4

Solved

I have upgraded API project from .NET 5 to .NET 6 successfully and running fine when executed locally (without Docker). I have also updated the version in Dockerfile from "5.0-alpine3.13"...

4

Solved

I am coming from a heavy Java/Spring background and trying to transition some knowledge over to ASP.NET Core 6. In Spring, on a RestController, I am able to route the request based on the presence ...
Imbecile asked 8/1, 2022 at 12:17

7

Solved

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 exa...
Jola asked 28/12, 2021 at 19:21

2

I put using Serilog on the top within each class where I want to add logs. But, when I want to add logs in Program.cs in order to log the information / error for DB connection, I find that the logs...
Biplane asked 8/7, 2023 at 4:32

2

Solved

Full Error: InvalidOperationException: Cannot get the value of a token type 'Number' as a string. System.Text.Json.Utf8JsonReader.GetString() JsonException: The JSON value could not be converted to...
Catharina asked 13/11, 2022 at 21:35

2

Solved

I am writing a worker service that needs to use Serilog and write to a log file. (.net core 6 and Windows service). The same service, when using Microsoft.Extensions.Logging and writing event logs ...
Dorise asked 9/3, 2022 at 16:45

2

Solved

I've created a new project using .NET 6 and EF Core 6 but when I try to create a migration using dotnet ef migrations add, the CLI begins running the application after "Build succeeded."....

© 2022 - 2024 — McMap. All rights reserved.