Use this tag for questions specifically related to version 7.0 of the .NET platform. For questions on .NET Framework generally, use the .net tag.
Questions tagged [.net-7.0]
1169 questions
2
votes
0 answers
Error while using managed identity for app configuration with Azure Function App
We have a v4 Azure Function App - isolated .Net7.
We are using Azure App configuration to fetch configs and feature flags.
But Intermittently function app is crashing with below error. (Happens like 2-3 times in a minute)
This is in Function app ->…

pradeep
- 21
- 3
2
votes
2 answers
Get Context.User.Identity from signalr hub in blazor server app (.NET 7)
I would like to understand why Context.User.Identity.Name is null and why Context.User.Identity.IsAuthenticated is false inside a signalr Hub in the onConnectedAsync method? Msdn says:
"SignalR can be used with ASP.NET Core authentication to…

Nicolas
- 21
- 2
- 3
2
votes
2 answers
ASP.NET Core - Using scoped service in background job
I have a few background jobs in my application that modify the database on an interval (from a few minutes to several hours). All of them have a while loop that uses the stoppingToken.IsCancellationRequested condition.
Currently I am creating and…

Parsa99
- 307
- 1
- 13
2
votes
0 answers
CultureInfo only gives 2 letters language names
I want to use the CultureInfo.NativeName but something is off. I always get a two letter combination as output. Ex sv (SE), en (US), es (BR). I created a completly new blazor project (WASM), ran the code there - same result, asked a colleague - same…

Cedervall
- 1,309
- 2
- 13
- 20
2
votes
2 answers
.NET 7.0: HttpClient not sending DefaultRequestHeaders when executing a 301 redirect
I'm puzzled at seeing how a HttpClient instance is not sending DefaultRequestHeaders (specifically the Authorization header) when following a 301 redirect. Considering the name of the collection (i.e., DefaultRequestHeaders) I would expect these to…

whatever
- 2,492
- 6
- 30
- 42
2
votes
2 answers
How to get assembly's processor architecture with .net 7+ from the running assembly?
Until .net 6 I couldl get the processor architecture (eg., MSIL, Amd64) of the current assembly with:
Assembly.GetExecutingAssembly().GetName().ProcessorArchitecture
But is obsolete since .net7.
It was suggested to use something from the namespace…

Soleil
- 6,404
- 5
- 41
- 61
2
votes
1 answer
FluentValidation validate automatically the request .NET 7 Minimal API
I'm using FluentValidation 11.5.1.
I don't want to use:
// MapPost //
public static void AddUser([FromBody] UserRequest, [FromServices] IValidator validator)
I want it to be automatic:
public static void AddUser([FromBody]…

Vadim Tomashevsky
- 182
- 1
- 12
2
votes
1 answer
Azure Function .net 7 Isolated Logging
We've moved from Net6 in-process to Net7 Isolated functions and the logging seems to have changed significantly. Nothing we try seems to get the logging working in a consistent way.
Locally:
Locally we want to be able to see all messages logged to…

user351711
- 3,171
- 5
- 39
- 74
2
votes
1 answer
Upgrading from .NET 6.0 to .NET 7.0
For a current visual studio 2022 solution I am trying to change the target framework from .NET 6.0 to .NET 7.0. I have downloaded the sdk for this and if I go to create a new solution, .NET 7.0 is now an option for the targeted framework. However,…

lross33
- 91
- 1
- 10
2
votes
0 answers
Visual Studio 2022 removes part of connection string on publish - .NET 7
My appsetting.json file contains :
"ConnectionStrings": {
"Server=localhost;Database=db;Trusted_Connection=True;encrypt=false;MultipleActiveResultSets=true"
}
After migration to .NET 7 and EF Core 7, new default value for encrypt is true.
But,…

mordechai
- 829
- 1
- 7
- 23
2
votes
0 answers
Scaffold-Dbcontext failed - The server was not found or was not accessible
I have created a database using SQL Server Management Studio v18. My authentication method is set to SQL Server authentication.
I am trying to run Scaffold-Dbcontext command from the Package manager console like this:
Scaffold-DbContext…

Amir Ben Shimol
- 109
- 6
2
votes
1 answer
Getting the request body as a string in and EndpointFilter .Net 7
I created a simple endpoint filter on a C# minimal api and when I try to get the body into a string it is always blank.
app.MapPost("/todo", async (Todo todo) =>
{
await Task.Run(() => { string x = "R";});
return…

Joe Anzalone
- 23
- 2
2
votes
2 answers
Installing dotnet-sdk-7.0 on Ubuntu 20.04 (and 22.04) breaks net6.0 projects (and net7.0 doesn't work either). Sudo needed to build after this
I follow these instructions to install dotnet on Ubuntu 20.04.
Install the sdk Ubuntu 20.04
These instruction is at this time:
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo…

HackerBaloo
- 397
- 2
- 11
2
votes
1 answer
Entity Framework Core auto value generation of 'last modified' column with data annotations and Postgresql
I'm using .NET 7 with Entity Framework Core and postgresql (npgsql).
I want to add autogenerated CreateOn and ModifiedOn columns to all my tables. I want them to update to the current datetime when a row is inserted or updated respectively.
So my…

Daniel Goldberg
- 101
- 6
2
votes
2 answers
How to set input type date's default value to today?using ASP net core 7.0
or
ViewData["greeting2"] = "01/01/2023";
resual :
I want…

Nhat Ho
- 21
- 2