Closed eerhardt closed 3 years ago
I was able to repro this. Dropping some logged info here in case it's helpful later...
trce: Microsoft.AspNetCore.Server.Kestrel.Http2[37]
Connection id "0HMA2FMPU9JHK" received HEADERS frame for stream ID 25 with length 22 and flags END_STREAM, END_HEADERS, PRIORITY.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/2 GET https://localhost:5001/ - -
trce: Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware[2]
All hosts are allowed.
dbug: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1000]
No candidates found for the request path '/'
dbug: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[2]
Request did not match any endpoints
dbug: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[4]
The request path / does not match a supported file type
info: OrchardCore.Modules.ModularTenantRouterMiddleware[0]
Begin Routing Request
dbug: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1000]
No candidates found for the request path '/'
dbug: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[2]
Request did not match any endpoints
dbug: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[4]
The request path / does not match a supported file type
trce: Microsoft.AspNetCore.Server.Kestrel.Http2[49]
Connection id "0HMA2FMPU9JHK" sending HEADERS frame for stream ID 25 with length 38 and flags END_STREAM, END_HEADERS.
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/2 GET https://localhost:5001/ - - - 404 0 - 0.4202ms
@pranavkm @javiercn I haven't dug in here enough yet but it might be an MVC or routing problem.
@davidfowl there are two things that I can think about being problematic here:
I was expecting to see an app.UseEndpoints(endpoints => endpoints.MapControllers())
Not sure if app.UseOrchardCore();
is doing it internally, but if so, it should not. We provide explicit guidance to customers not to subsume UseRouting and UseEndpoints within their own extension methods.
Yea, but it used to work in .NET 5, this is a compat break in .NET 6. We need to figure out why it broke
UseOrchardCore is doing it internally. Along with alot of other crazy things 😄
@davidfowl my money is on application parts not working well with top-level statements or some of the new minimal hosting APIs, that's what I would check first.
Does it work outside of orchard?
Top level statements? Yes.
Thanks for contacting us.
We're moving this issue to the Next sprint planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
OK this is a bit more insidious than I thought, and it might not be an MVC or routing issue (yet). There are no IActionDescriptorProviders
registered...
Found the issue. It's this change https://github.com/dotnet/aspnetcore/commit/2af293dc72625b865fa7fcad5aeb510df46386bd. This works:
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.DependencyInjection.Extensions;
Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webbuilder =>
{
webbuilder.Configure(app =>
{
app.UseOrchardCore();
});
})
.ConfigureServices(services =>
{
services.RemoveAll<IActionDescriptorCollectionProvider>();
services.RemoveAll<IApiDescriptionGroupCollectionProvider>();
services.AddOrchardCms();
})
.Build()
.Run();
It seems orchard relies on certain services not being added by the shell application. In this case the IActionDescriptorCollectionProvider
was added by the call to AddEndpointsApiExplorer()
which results in orchard finding 0 action descriptors. This seems like a bug in orchard IMO but it is a regression so we need to decide what to do here.
Verified and it has been fixed on SDK dotnet-sdk-6.0.100-preview.7.21363.2.Thanks.
Describe the bug
When trying to use OrchardCore on a net6.0 app, the default page 404s.
To Reproduce
Exceptions (if any)
(Note: there is a background NullReferenceException occurring in DependencyInjection code. That is tracked by https://github.com/dotnet/runtime/issues/55255. I've fixed it locally and ensured that this issue still occurs even when the NRE is fixed.)
Further technical details
dotnet --info
Runtime Environment: OS Name: Windows OS Version: 10.0.19043 OS Platform: Windows RID: win10-x64 Base Path: C:\dotnet\sdk\6.0.100-preview.7.21357.29\
Host (useful for support): Version: 6.0.0-preview.7.21356.2 Commit: 566b53a66b
.NET SDKs installed: 6.0.100-preview.7.21357.29 [C:\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.0-preview.7.21355.4 [C:\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.0-preview.7.21356.2 [C:\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.0-preview.7.21352.1 [C:\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download