Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joey Ireland 5 posts 73 karma points
    Sep 20, 2023 @ 20:36
    Joey Ireland
    0

    New Document Type With Template Page Error 500

    Hi all I am running on a Umbraco 12 site hosted on IIS using model builder set to Auto and when I create a new document type with a template and then rebuild model builder in the settings menu I get this error in the log and my page is just error 500. I can see the generated model in the models folder but the page will not load. any help would be great I've been bashing my head on it for a while.

    I have even tried deleting the generated model and then switching models builder to Manual and using the settings menu to rebuild, restarting the website on IIS, making sure the models folder has maximum permissions and still comes up with the same error.

    {"@t":"2023-09-20T20:28:23.4309666Z","@mt":"Connection ID \"{ConnectionId}\", Request ID \"{TraceIdentifier}\": An unhandled exception was thrown by the application.","@l":"Error","@x":"Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.CompilationFailedException: One or more compilation failures occurred:\r\nnqe33tsk.bt1(75,98): error CS0234: The type or namespace name 'EventRelease' does not exist in the namespace 'Umbraco.Cms.Web.Common.PublishedModels' (are you missing an assembly reference?)\r\nC:\\Websites\\foodanddrinknetwork.co.uk\\Views\\EventRelease.cshtml(19,140): error CS0119: 'PublishedContentExtensions.Parent<T>(IPublishedContent)' is a method, which is not valid in the given context\r\nC:\\Websites\\foodanddrinknetwork.co.uk\\Views\\EventRelease.cshtml(19,189): error CS0119: 'PublishedContentExtensions.Parent<T>(IPublishedContent)' is a method, which is not valid in the given context\r\nC:\\Websites\\foodanddrinknetwork.co.uk\\Views\\EventRelease.cshtml(19,208): error CS1503: Argument 1: cannot convert from 'method group' to 'object?'\r\nC:\\Websites\\joeymywebsite.com\\Views\\EventRelease.cshtml(20,35): error CS1503: Argument 1: cannot convert from 'method group' to 'object?'\r\nC:\\Websites\\joeymywebsite.com\\Views\\EventRelease.cshtml(34,76): error CS0119: 'PublishedContentExtensions.Parent<T>(IPublishedContent)' is a method, which is not valid in the given context\r\nC:\\Websites\\foodanddrinknetwork.co.uk\\Views\\EventRelease.cshtml(34,98): error CS0119: 'PublishedContentExtensions.Parent<T>(IPublishedContent)' is a method, which is not valid in the given context\r\n   at Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.RuntimeViewCompiler.CompileAndEmit(RazorCodeDocument codeDocument, String generatedCode)\r\n   at Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.RuntimeViewCompiler.CompileAndEmit(String relativePath)\r\n   at Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.RuntimeViewCompiler.OnCacheMiss(String normalizedPath)\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Razor.Compilation.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath)\r\n   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage)\r\n   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey)\r\n   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, String pageName, Boolean isMainPage)\r\n   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)\r\n   at Umbraco.Cms.Web.Website.ViewEngines.ProfilingViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)\r\n   at Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)\r\n   at Umbraco.Cms.Web.Common.Controllers.UmbracoPageController.EnsurePhsyicalViewExists(String template)\r\n   at Umbraco.Cms.Web.Common.Controllers.RenderController.CurrentTemplate[T](T model)\r\n   at Umbraco.Cms.Web.Common.Controllers.RenderController.Index()\r\n   at lambda_method29(Closure, Object, Object[])\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)\r\n   at Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.BackOffice.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\\projects\\dotnet\\src\\MiniProfiler.AspNetCore\\MiniProfilerMiddleware.cs:line 114\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry)\r\n   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()","ConnectionId":"18230571292401077089","TraceIdentifier":"40000b62-0000-fd00-b63f-84710c7967bb","EventId":{"Id":2,"Name":"ApplicationError"},"SourceContext":"Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer","RequestId":"40000b62-0000-fd00-b63f-84710c7967bb","RequestPath":"/events/ppma-show-2023/","ProcessId":6076,"ProcessName":"w3wp","ThreadId":53,"ApplicationId":"a6c44f7adc654ab51aebfe77d7378dc6bab922da","MachineName":"WIN-5Q188OSNIBD","Log4NetLevel":"ERROR"}
    
  • Huw Reddick 1821 posts 6256 karma points MVP 2x c-trib
    Sep 21, 2023 @ 07:46
    Huw Reddick
    0

    Hi Joey,

    When using modelsbuilder in this way you need to rebuild your application and redeploy it. For what you are doing you need to use InMemoryAuto if you want to access the models without rebuilding the application

  • Joey Ireland 5 posts 73 karma points
    Sep 21, 2023 @ 08:01
    Joey Ireland
    0

    Hi Huw,

    Thank you for the reply. When I turn my model builder to:

    "ModelsBuilder": { "ModelsMode": "InMemoryAuto","FlagOutOfDateModels": true, "ModelsDirectory": "~/umbraco/models" },
    

    And change from development to production I get a Boot Failed when loading my site after stopping the application pool and restarting. The error in the log is about building it in release mode so I think the issue then comes down to the way I have published it to IIS. Is it possible to take the models from the live site put it back into VS and rebuild them in there and copy over the DLL's?

  • Huw Reddick 1821 posts 6256 karma points MVP 2x c-trib
    Sep 21, 2023 @ 10:15
    Huw Reddick
    0

    Is it possible to take the models from the live site put it back into VS and rebuild them in there and copy over the DLL's?

    yes theoretically, generally when working with models in this way one would generally make all the chnages in dev/VS then publish to IIS once built, Modelsbuilder would be set to None on the live site so doc types only get created in dev.

Please Sign in or register to post replies

Write your reply to:

Draft