Closed jptissot closed 5 years ago
Error 500 on a tenant when trying to access unknown url:
[2:57:29 PM] fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[3]
An exception was thrown attempting to execute the error handler.
System.InvalidOperationException: The view 'NotFound' was not found. The following locations were searched:
/Areas/TheAgencyTheme/Views/Shared/NotFound.cshtml
/Views/NotFound.en-US.cshtml
/Views/NotFound.en.cshtml
/Views/NotFound.cshtml
/Views/Shared/NotFound.en-US.cshtml
/Views/Shared/NotFound.en.cshtml
/Views/Shared/NotFound.cshtml
/Pages/Shared/NotFound.en-US.cshtml
/Pages/Shared/NotFound.en.cshtml
/Pages/Shared/NotFound.cshtml
at Microsoft.AspNetCore.Mvc.ViewEngines.ViewEngineResult.EnsureSuccessful(IEnumerable`1 originalLocations)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, I
[2:57:29 PM] Disposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context)
at OrchardCore.Diagnostics.Startup.<Configure>b__3_0(HttpContext context, Func`1 next) in C:\Users\jptis\source\repos\OrchardCore\src\OrchardCore.Modules\OrchardCore.Diagnostics\Startup.cs:line 39
at Microsoft.AspNetCore.Builder.StatusCodePagesExtensions.<>c__DisplayClass6_0.<<UseStatusCodePagesWithReExecute>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
[2:57:29 PM] fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HLPNMB4G7FE6", Request id "0HLPNMB4G7FE6:00000083": An unhandled exception was thrown by the application.
System.InvalidOperationException: The view 'NotFound' was not found. The following locations were searched:
/Areas/TheAgencyTheme/Views/Shared/NotFound.cshtml
/Views/NotFound.en-US.cshtml
/Views/NotFound.en.cshtml
/Views/NotFound.cshtml
/Views/Shared/NotFound.en-US.cshtml
/Views/Shared/NotFound.en.cshtml
/Views/Shared/NotFound.cshtml
/Pages/Shared/NotFound.en-US.cshtml
/Pages/Shared/NotFound.en.cshtml
/Pages/Shared/NotFound.cshtml
at Microsoft.AspNetCore.Mvc.ViewEngines.ViewEngineResult.EnsureSuccessful(IEnumerable`1 originalLocations)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context)
at OrchardCore.Diagnostics.Startup.<Configure>b__3_0(HttpContext context, Func`1 next) in C:\Users\jptis\source\repos\OrchardCore\src\OrchardCore.Modules\OrchardCore.Diagnostics\Startup.cs:line 39
at Microsoft.AspNetCore.Builder.StatusCodePagesExtensions.<>c__DisplayClass6_0.<<UseStatusCodePagesWithReExecute>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) in C:\Users\jptis\source\repos\OrchardCore\src\OrchardCore\OrchardCore\Modules\ModularTenantRouterMiddleware.cs:line 82
at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute) in C:\Users\jptis\source\repos\OrchardCore\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 101
at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in C:\Users\jptis\source\repos\OrchardCore\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
Unable to login on localhost:5000 but works fine on localhost:5001
Sites feel really fast!
Created blog post successfully. See cypress branch for automated tests.
@jptissot thanks for trying it.
Just tried, it works with the blog recipe but not with the agency recipe, maybe because TheBlogTheme
overrides the NotFound
view but not TheAgencyTheme
, and in this last case it doesn't use the view defined in the diagnostics module.
Hmm, maybe i have already an idea why it doesn't do that, i will fix it soon.
Fixed
Unable to login on localhost:5000 but works fine on localhost:5001
I will now check this
So, about localhost:5000
i was not able to access the site if started from Visual Studio in debug mode.
But if started from the command line, i could access it, and then login was working.
EXCITEMENT - i'll try it soon @jtkech
Thanks, hope there will not be too many issues ;)
Note: pinned a version of packages that supports 2.2 on myget is: 1.0.0-beta3-72452
I will be trying this on some internal apps to see if I can find other issues tomorrow.
Don't know if related. I just created simple razor page in theme Pages folder:
@page
@inject OrchardCore.IOrchardHelper Orchard
@model MyProject.Theme.Light.Pages.testModel
@{
}
<h1>RAZOR PAGE</h1>
when accessing it I get:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageLoaderMatcherPolicy.ApplyAsync(HttpContext httpContext, CandidateSet candidates)
at Microsoft.AspNetCore.Routing.Matching.DfaMatcher.SelectEndpointWithPoliciesAsync(HttpContext httpContext, IEndpointSelectorPolicy[] policies, CandidateSet candidateSet)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>g__AwaitMatch|8_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask)
at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) in C:\projects\orchardcore\src\OrchardCore\OrchardCore\Modules\ModularTenantRouterMiddleware.cs:line 82
at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute) in C:\projects\orchardcore\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 101
at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in C:\projects\orchardcore\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
@arkadiuszwojcik add this to the Startup class
services.AddOrchardCms().AddRazorPages();
@emekaemego when I add this I get exception on startup:
InvalidOperationException: The view 'Display' was not found. The following locations were searched: /Areas/OrchardCore.Contents/Views/Item/Display.cshtml /Areas/OrchardCore.Contents/Views/Shared/Display.cshtml /Views/Shared/Display.cshtml /Pages/Shared/Display.cshtml
In my original webpage project I am using liquid views, just wanted to add razor page for tests purpose. Don't know if such mixing is valid.
@arkadiuszwojcik If OrchardCore.Contents
is not referenced in your project, that could be the cause.
@emekaemego I have OrchardCore.Contents
listed in my setup recipe in dependencies list. Do I need explicit reference in project file?
So after adding explicit reference to OrchardCore.Contents
in theme project and main web project I still get this exception after adding line: AddRazorPages()
Full exception:
System.InvalidOperationException: The view 'Display' was not found. The following locations were searched:
/Areas/OrchardCore.Contents/Views/Item/Display.cshtml
/Areas/OrchardCore.Contents/Views/Shared/Display.cshtml
/Views/Shared/Display.cshtml
/Pages/Shared/Display.cshtml
at Microsoft.AspNetCore.Mvc.ViewEngines.ViewEngineResult.EnsureSuccessful(IEnumerable`1 originalLocations)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context)
at OrchardCore.Diagnostics.Startup.<Configure>b__3_0(HttpContext context, Func`1 next) in C:\projects\orchardcore\src\OrchardCore.Modules\OrchardCore.Diagnostics\Startup.cs:line 40
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) in C:\projects\orchardcore\src\OrchardCore\OrchardCore\Modules\ModularTenantRouterMiddleware.cs:line 82
at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute) in C:\projects\orchardcore\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 101
at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in C:\projects\orchardcore\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
@jtkech can you try the Demo project and all the things it's supposed to show, just to be sure they still work?
@arkadiuszwojcik I don't think AddRazorPages()
is causing this particular error. You're getting a different error from the initial one before adding AddRazorPages()
. This could be a bug in OC, but try see if any of these could help show where the error is coming from.
See if you can navigating to a different page without any exception Try a plain razor page without a layout
can you try the Demo project
I did it at some point but not on every release
Okay, just tried, i could repro the exact same original 1st trace. I will work on it very soon.
So going back to my original issue. Steps to reproduce:
<Project Sdk="Microsoft.NET.Sdk.Razor">
NOTE: I'm not using AddRazorPages()
in this example.
I got exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageLoaderMatcherPolicy.ApplyAsync(HttpContext httpContext, CandidateSet candidates)
at Microsoft.AspNetCore.Routing.Matching.DfaMatcher.SelectEndpointWithPoliciesAsync(HttpContext httpContext, IEndpointSelectorPolicy[] policies, CandidateSet candidateSet)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>g__AwaitMatch|8_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask)
at OrchardCore.Modules.ModularTenantRouterMiddleware.Invoke(HttpContext httpContext) in C:\MyGit\OrchardCore\src\OrchardCore\OrchardCore\Modules\ModularTenantRouterMiddleware.cs:line 82
at OrchardCore.Environment.Shell.Scope.ShellScope.UsingAsync(Func`2 execute) in C:\MyGit\OrchardCore\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 99
at OrchardCore.Modules.ModularTenantContainerMiddleware.Invoke(HttpContext httpContext) in C:\MyGit\OrchardCore\src\OrchardCore\OrchardCore\Modules\ModularTenantContainerMiddleware.cs:line 59
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
When debugging:
Looks like some routing problem. There are two route propositions (why two?) first one is correct and endpoint is /test
, second one is invalid with endpoint set to NULL
what causes NullReferenceException
You don't need AddRazorPages
it is called by AddMvc
that we call at the tenant level.
Yes, we need to find why there is this null endpoint, was not the case before
Thanks for the infos, i'm working on it.
Note: with my bad connection, it is very long to load all symbols to step into aspnetcore code ;)
Okay, there are some conflicts with what we do recently around Autoroutes
. E.g we now have
routes.MapDynamicControllerRoute<AutoRouteTransformer>("/{any}/{**slug}");
If i remove this line, i don't have anymore this null endpoint and razor page endpoints work again, at least with the demo module. But then autoroute doesn't work anymore ;) But i made some progress !
So, i found a fix / workaround, see #4272
Maybe an issue in PageLoaderMatcherPolicy
, all razor pages work again if i replace it with a custom implementation where i just added the following checking as it is done in other policies.
if (!candidates.IsValidCandidate(i))
{
continue;
}
See my comments in #4272.
When I update to .NET Core 3.0, there is this warning in the Build output:
C:\Program Files\dotnet\sdk\3.0.100-preview9-014004\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(39,5): warning NETSDK1086: A FrameworkReference for 'Microsoft.AspNetCore.App' was included in the project. This is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs
In the .csproj, the reference is added like this:
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Sometime we need it but not always, i'ii try to clean it.
As i remember, so not sure, maybe in some places we need it as long as we have a preview version installed. I will check it this night.
When I update to .NET Core 3.0, there is this warning in the Build output:
For info when I remove it from a NuGet .csproj startup everything still works fine
I have 2 warnings left :
Severity Code Description Project File Line Suppression State Suppression State
Warning OC2003 NETStandard.Library@1.6.1 is an unmanaged PackageReference OrchardCore.Data \src\OrchardCore\OrchardCore.Data\OrchardCore.Data.csproj 1
One on OrchardCore.Data and OrchardCore.OpenId.Core.EntityFrameworkCore.
Yes, we still need to reference explicitly NETStandard.Library@1.6.1, see the comments e.g in OC.Data.csproj
. Otherwise a self contained publish would not work.
<!-- TODO: Remove this reference once SQLite targets netstandard2.0 -->
<!-- c.f., https://github.com/aspnet/EntityFrameworkCore/issues/15969 -->
<PackageReference Include="NETStandard.Library" Version ="1.6.1" />
For infos, about the razor pages issue i filled an issue on aspnetcore https://github.com/aspnet/AspNetCore/issues/13996
@agriffard i did some tests, maybe we don't have the same sdk version installed. E.g in the sdk .props and .tagerts i don't retrieve NETSDK1086
, but e.g i have the following that said that it is implicit with the NET.Sdk.Web
, otherwise we need to use a FrameworkReference
(not a PackageReference
).
<!-- NETSDK1080: A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher.
If Microsoft.NET.Sdk.Web is used, the shared framework will be referenced automatically. Otherwise, the PackageReference
should be replaced with a FrameworkReference. -->
So, on my machine i only had the 2 warnings mentioned by @Skrypt that is a known "issue".
Note: FrameworkReference
are compilation references, it also prevents from having to reference any package shipped with aspnetcore. I did some tests, a project doesn't need it if it references another project that does it for him. So, we could remove it from many projects that have a shared reference (e.g OC.Abstractions
) and in which we let this FrameworkReference
.
Having trouble logging into a site created with the blank site recipe
Thought it might have been fixed with https://github.com/OrchardCMS/OrchardCore/pull/4272 but tried and no.
@jtketch no homeroute on the blank site by default, so maybe similar issue?
Repro.
Log file
2019-09-15 08:48:09.3816|None|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Hosting.Diagnostics|INFO|Request starting HTTP/2.0 POST https://localhost:44300/blanksite2?returnurl=%2Fblanksite2%2Fadmin&action=Login&controller=Account application/x-www-form-urlencoded 253
2019-09-15 08:48:09.3965|None|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|DEBUG|POST requests are not supported
2019-09-15 08:48:09.4077|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||OrchardCore.Modules.ModularTenantRouterMiddleware|INFO|Begin Routing Request
2019-09-15 08:48:09.4077|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Routing.Matching.DfaMatcher|DEBUG|1 candidate(s) found for the request path ''
2019-09-15 08:48:09.4218|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Routing.Matching.DfaMatcher|DEBUG|Endpoint '/' with route pattern '/' is valid for the request path ''
2019-09-15 08:48:09.4218|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware|DEBUG|Request did not match any endpoints
2019-09-15 08:48:09.4218|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|DEBUG|POST requests are not supported
2019-09-15 08:48:09.4366|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler|DEBUG|AuthenticationScheme: Identity.Application was not authenticated.
2019-09-15 08:48:09.4366|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|DEBUG|POST requests are not supported
2019-09-15 08:48:09.4366|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Routing.Matching.DfaMatcher|DEBUG|1 candidate(s) found for the request path '/Error/404'
2019-09-15 08:48:09.4521|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Routing.Matching.DfaMatcher|DEBUG|Endpoint 'OrchardCore.Diagnostics.Controllers.DiagnosticsController.Error (OrchardCore.Diagnostics)' with route pattern 'Error/{status?}' is valid for the request path '/Error/404'
2019-09-15 08:48:09.4521|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware|DEBUG|Request matched endpoint 'OrchardCore.Diagnostics.Controllers.DiagnosticsController.Error (OrchardCore.Diagnostics)'
2019-09-15 08:48:09.4521|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|DEBUG|Static files was skipped as the request already matched an endpoint.
2019-09-15 08:48:09.4743|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler|DEBUG|AuthenticationScheme: Identity.Application was not authenticated.
2019-09-15 08:48:09.4743|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware|DEBUG|Static files was skipped as the request already matched an endpoint.
2019-09-15 08:48:09.4848|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Routing.EndpointMiddleware|INFO|Executing endpoint 'OrchardCore.Diagnostics.Controllers.DiagnosticsController.Error (OrchardCore.Diagnostics)'
2019-09-15 08:48:09.4848|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|INFO|Route matched with {area = "OrchardCore.Diagnostics", action = "Error", controller = "Diagnostics"}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IActionResult Error(System.Nullable1[System.Int32]) on controller OrchardCore.Diagnostics.Controllers.DiagnosticsController (OrchardCore.Diagnostics). 2019-09-15 08:48:09.4848|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|DEBUG|Execution plan of authorization filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.AutoValidateAntiforgeryTokenAuthorizationFilter 2019-09-15 08:48:09.5011|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|DEBUG|Execution plan of resource filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.SaveTempDataFilter 2019-09-15 08:48:09.5011|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|DEBUG|Execution plan of action filters (in the following order): Microsoft.AspNetCore.Mvc.Filters.ControllerActionFilter (Order: -2147483648), Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilter (Order: -3000), OrchardCore.DisplayManagement.ModelBinding.ModelBinderAccessorFilter, OrchardCore.DisplayManagement.Notify.NotifyFilter, OrchardCore.Admin.AdminZoneFilter, OrchardCore.Admin.AdminFilter (Order: 0) 2019-09-15 08:48:09.5011|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|DEBUG|Execution plan of exception filters (in the following order): None 2019-09-15 08:48:09.5148|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|DEBUG|Execution plan of result filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.SaveTempDataFilter, OrchardCore.DisplayManagement.Notify.NotifyFilter, OrchardCore.DisplayManagement.Razor.RazorViewResultFilter, OrchardCore.Admin.AdminFilter (Order: 0), OrchardCore.Admin.AdminMenuFilter, OrchardCore.Layers.Services.LayerFilter 2019-09-15 08:48:09.5148|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery|DEBUG|Antiforgery successfully validated a request. 2019-09-15 08:48:09.5148|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|DEBUG|Executing controller factory for controller OrchardCore.Diagnostics.Controllers.DiagnosticsController (OrchardCore.Diagnostics) 2019-09-15 08:48:09.5381|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|DEBUG|Executed controller factory for controller OrchardCore.Diagnostics.Controllers.DiagnosticsController (OrchardCore.Diagnostics) 2019-09-15 08:48:09.5381|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder|DEBUG|Attempting to bind parameter 'status' of type 'System.Nullable
1[System.Int32]' ...
2019-09-15 08:48:09.5483|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ModelBinding.Binders.SimpleTypeModelBinder|DEBUG|Attempting to bind parameter 'status' of type 'System.Nullable1[System.Int32]' using the name 'status' in request data ... 2019-09-15 08:48:09.5483|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ModelBinding.Binders.SimpleTypeModelBinder|DEBUG|Done attempting to bind parameter 'status' of type 'System.Nullable
1[System.Int32]'.
2019-09-15 08:48:09.5483|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder|DEBUG|Done attempting to bind parameter 'status' of type 'System.Nullable1[System.Int32]'. 2019-09-15 08:48:09.5619|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder|DEBUG|Attempting to validate the bound parameter 'status' of type 'System.Nullable
1[System.Int32]' ...
2019-09-15 08:48:09.5619|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder|DEBUG|Done attempting to validate the bound parameter 'status' of type 'System.Nullable`1[System.Int32]'.
2019-09-15 08:48:09.5752|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine|DEBUG|View lookup cache hit for view 'NotFound' in controller 'Diagnostics'.
2019-09-15 08:48:09.5752|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor|INFO|Executing ViewResult, running view NotFound.
2019-09-15 08:48:09.5752|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor|DEBUG|The view path '/Areas/OrchardCore.Diagnostics/Views/Diagnostics/NotFound.cshtml' was found in 13.2689ms.
2019-09-15 08:48:09.5944|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor|INFO|Executed ViewResult - view NotFound executed in 19.832800000000002ms.
2019-09-15 08:48:09.6058|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker|INFO|Executed action OrchardCore.Diagnostics.Controllers.DiagnosticsController.Error (OrchardCore.Diagnostics) in 82.3936ms
2019-09-15 08:48:09.6058|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Routing.EndpointMiddleware|INFO|Executed endpoint 'OrchardCore.Diagnostics.Controllers.DiagnosticsController.Error (OrchardCore.Diagnostics)'
2019-09-15 08:48:09.6058|blanksite2|8000012d-0003-ff00-b63f-84710c7967bb||Microsoft.AspNetCore.Hosting.Diagnostics|INFO|Request finished in 236.1439ms 404 text/html; charset=utf-8
@deanmarcussen thanks for the feedback
Yes, we used recently route transformers, which is a good thing because it improved perfs, but i didn't re-do all possible tests ;)
I will fix it this night.
@deanmarcussen fixed, a simple fix, i will do a PR this night.
Nice one @jtkech . All generally looking great IMO. Got two sites migrated and up on Azure today on 3, all seem just fine, and the speed improvements are great
One of my module doesn't compile.
OK I fixed it by adding <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" />
<PackageReference Include="OrchardCore.Infrastructure.Abstractions" Version="1.0.0-beta3-72516" />
<PackageReference Include="OrchardCore.Module.Targets" Version="1.0.0-beta3-72516" />
<PackageReference Include="OrchardCore.Navigation" Version="1.0.0-beta3-72516" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
</ItemGroup>
</Project>
If you have a library that uses ASP.NET Core packages, don't forget to include <FrameworkReference />
(https://github.com/aspnet/AspNetCore/issues/3612)
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>
Awesome work on this guys!
This is a decoupled project. The problem is that when I deploy, the customization for the shape doesn't work. I need to manually copy over the Views
folder to the deployed binaries.
I deploy using dotnet publish -c Release -o "C:\Releases\SilverKey Website\Web"
Now my site runs on ASP.NET Core 3 (it is fast 😄 ). This is the only problem (https://github.com/OrchardCMS/OrchardCore/issues/4261#issuecomment-531768762)
Steps needed when migrating an application.
Install dotnet core 3.0 rc.
Modify all .csproj files to target netcore 3.0
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
to
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
Change docker images to use 3.0 images
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0
Change IHostingEnvironment
to IWebHostEnvironment
or IHostEnvironment
Add using Microsoft.Extensions.Hosting;
to be able to use env.IsDevelopment()
Change <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
to <FrameworkReference Include="Microsoft.AspNetCore.App" />
Rename IRouteBuilder
to IEndpointRouteBuilder
in Configure startup method.
Change MapAreaRoute
to MapAreaControllerRoute
and change template
to pattern
in the route definition object.
Change all instances of netcoreapp2.2 to netcoreapp3.0.
Seems that the following is no more needed, i will do a PR.
<LangVersion>preview</LangVersion>
@dodyg so, it's related to shape template views defined at the application level, right?
Just tried in debug mode, it works, i'll try it in a published context.
Change IHostingEnvironment to IWebHostEnvironment
IWebHostEnvironment
or IHostEnvironment
Updated comment to reflect suggestions.
Yes, IWebHostEnvironment
in the case you have to use .WebRootPath
or .WebRootFileProvider
.
@dodyg so, it's related to shape template views defined at the application level, right?
@jtkech yes.
@dodyg i did some tests and now i remember what's the only limitation.
So, we are talking about views defined at the application level and then not outputed on publishing because precompiled.
It works for razor Pages and for pure mvc views (tied to a controller), i re-tried it.
Then, for a shape view, a file need to exist so that the shape is discovered, then the precompiled version will be used. For a regular module that's ok because a precompiled view is in its related .Views.dll
, and the file itself is still there because it is embedded in its assembly.
It works for a razor page or pure mvc view because the razor engine looks in the related .Views.dll
. It would work for a shape but the problem is that we didn't have discovered it if it is not there. We would need a custom file provider that lookups in the .Views.dll
as the razor engine do.
At some point i did such a custom file provider but we removed it. So, the only limitation is that, for shape razor view templates defined at the app level, you need to output them on publishing, as we need to do for shape liquid view templates defined at the app level that can't be precompiled. You can do that with the right options in your application project file.
As a reminder, again due to the home route transformer, if you define an home route and also an application razor Index
page, we ends up with 2 valid endpoints for the path /
. So, here it complains that these 2 endpoints for the same path have the same order.
I will fix it soon ;)
Update: Fixed through #4299.
I tried updating Sipke Schoorstra multitenant demo from medium to .net core 3, and got this error when adding multitenant
System.AggregateException
HResult=0x80131500
Message=Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: OrchardCore.Environment.Shell.Descriptor.IShellDescriptorManager Lifetime: Scoped ImplementationType: OrchardCore.Environment.Shell.Descriptor.Settings.ConfiguredFeaturesShellDescriptorManager': Unable to resolve service for type 'OrchardCore.Environment.Shell.Configuration.IShellConfiguration' while attempting to activate 'OrchardCore.Environment.Shell.Descriptor.Settings.ConfiguredFeaturesShellDescriptorManager'.)
Source=Microsoft.Extensions.DependencyInjection
StackTrace:
at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(IEnumerable1 serviceDescriptors, ServiceProviderOptions options) at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options) at Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder) at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter
1.CreateServiceProvider(Object containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at MultiTenantApp.Program.Main(String[] args) in C:\Users\lague\source\repos\MultiTenantApp\Program.cs:line 17
Inner Exception 1: InvalidOperationException: Error while validating the service descriptor 'ServiceType: OrchardCore.Environment.Shell.Descriptor.IShellDescriptorManager Lifetime: Scoped ImplementationType: OrchardCore.Environment.Shell.Descriptor.Settings.ConfiguredFeaturesShellDescriptorManager': Unable to resolve service for type 'OrchardCore.Environment.Shell.Configuration.IShellConfiguration' while attempting to activate 'OrchardCore.Environment.Shell.Descriptor.Settings.ConfiguredFeaturesShellDescriptorManager'.
Inner Exception 2: InvalidOperationException: Unable to resolve service for type 'OrchardCore.Environment.Shell.Configuration.IShellConfiguration' while attempting to activate 'OrchardCore.Environment.Shell.Descriptor.Settings.ConfiguredFeaturesShellDescriptorManager'.
The source cand be found at
Will document issues I find when moving to Core 3.0 here.