I have created .NET Core 7 App
and deployed to Azure App Service. Even I got the same error.

In Azure Portal
=> App Service
=> Configuration => General Settings
, .NET Version
is shown as .NET 6(LTS)

This is because .NET 7 is still in preview version. So by default, it is taken as .NET 6.
Even after updating the Version to .NET 7 (Preview), In KUDU Console I can see the version as .NET 7 RC1
.

How to install dotNET 7 RC2 in App Service
In Azure App service, we have 2 ways to install versions.
Way1 :
In KUDU Console
=> Site extensions
=> Gallery
type .NET Core 7
in search box , you will find an option to install extensions.
Click on the +
sign to install the required extension.

Path to SCM - https://YourAppName.scm.azurewebsites.net/
Way2:
Navigate to Azure Portal
=> Your App Service
=> Under Developer Tools
Click on Extensions
=> Add
Search for asp.net core
, you will find runtime versions related to .NET 7 RC2

Select the required extension
and click on Accept legal terms
and click on OK
After adding the extensions in Azure App Service, In VS i have tried to Publish again, I got the below Warning

It clearly says that,In Azure App Service there is no support for .NET 7 RC2
as of now.
Under Settings
=> Change the Deployment Mode
to Self-contained
,Save and Publish the App.

Now Iam able to access the App without any issues.
