当将blazor应用程序托管到windows服务器时,我如何解决以下问题



当我将blazor应用程序上传到windows服务器时,出现以下问题。我尝试过不同的解决方案,但都没能成功。如果任何机构都遇到了同样的问题,并且能够在这方面提供帮助,那么这将是有帮助的。

它在本地运行良好,但当我发布blazor.server应用程序,然后上传或托管到服务器时,就会出现这个问题。它位于asp.net内核3.1中。

crit:Microsoft.AspNetCore.Components.WebAssembly.Frendering.WebAssemblyRenderer[100]呈现组件时出现未处理的异常:找不到类型Microsoft.AspNetCore.Components.Authorization.CascadingAuthenticationState的默认构造函数System.MissingMethodException:找不到类型Microsoft.AspNetCore.Components.Authorization.CascadingAuthenticationState的默认构造函数在System.RuntimeType.CreateInstanceMono(System.Boolean nonPublic,System.Boolean wrappeExceptions(<0x1c4b380+0x000b0>在:0在System.RuntimeType.CreateInstanceSlow(System.Boolean publicOnly,System.Boolean wrapExceptions,System.Boo布尔skipCheckThis,System.Boole fillCache(<0x1c4b1b8+0x0001c>在:0在System.RuntimeType.CreateInstanceDefaultCtor(System.Boolean publicOnly,System.Boolean skipCheckThis,System.Boo布尔fillCache,System.Boole wrapExceptions,System.Threading.StackCrawlMark&stackMark(<0x1c4b050+0x002e>在:0在System.Activator.CreateInstance(System.Type类型,System.Boolean nonPublic,System.Boole wrappeExceptions(<0x1ca3880+0x00062>在:0在System.Activator.CreateInstance(System.Type类型,System.Boolean nonPublic(<0x1ca3840+0x0000a>在:0在System.Activator.CreateInstance(System.Type类型(<0x1ca3780+0x00006>在:0位于Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(System.IServiceProvider serviceProvider,System.Type componentType(<0x1ca3660+0x00006>在:0位于Microsoft.AspNetCore.Components.RenderTree.Render.InstantiateComponent(System.Type componentType(<0x1ca26d8+0x00014>在:0位于Microsoft.AspNetCore.Components.RenderTree.Render.InstantiateChildComponentOnFrame(Microsoft.AspNetCore.Components.RenderTree.RederTreeFrame&frame,System.Int32 parentComponentId(<0x1f5c1e0+0x0005c>在:0位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(Microsoft.AspNetCore.Components.RenderTree.FrenderTreeDiffBuilder+DiffContext&DiffContext,System.Int32 frameIndex(<0x1f5c070+0x004c>在:0位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(Microsoft.AspNetCore.Components.RenderTree.FenderTreediffBuilder+DiffContext&DiffContext,System.Int32 frameIndex(<0x1f5bdf0+0x0007a>在:0位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(Microsoft.AspNetCore.Components.RenderTree.FenderTreediffBuilder+DiffContext&DiffContext,System.Int32 newFrameIndex(<0x1f5bae8+0x000b4>在:0位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(Microsoft.AspNetCore.Components.RenderTree.EnderTreeDiffBuilder+DiffContext&DiffContext、System.Int32 oldStartIndex、System.Int32oldEndIndexExcl、System.Int32-newStartIndex、System Int32 newEndIndexExcl(<0x1f5af18+0x048c>在:0位于Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Microsoft.AspNetCore.Components.RenderTree Renderer渲染器、Microsoft.AspNetCore.Components Rendering.RenderBatchBuilder批处理生成器、System.Int32 componentId、Microsoft.AspNetCore.Components/RenderTree.ArrayRange1[T] oldTree, Microsoft.AspNetCore.Components.RenderTree.ArrayRange1[T]newTree(<0x1f59ff0+0x0008c>在:0位于Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(Microsoft.AspNetCore.Components.Rendering.RenderBatchBuilder batchBuilder、Microsoft.AspNet Core.Components RenderFragment RenderFragment(<0x1f53dd0+0x00100>在:0位于Microsoft.AspNetCore.Components.RenderTree.Render.RenderInExistingBatch(Microsoft.AspNetCore.Components.Rendering.RenderQueueEntry RenderQueueEntry(<0x1f518e0+0x0004c>在:0位于Microsoft.AspNetCore.Components.RenderTree.Render.ProcessRenderQueue((<0x1f51020+0x0092>in:0

对此不确定,但在我看来,禁用链接器可以解决问题。。。这是一个临时解决方案。。。有关正确的解决方案,请咨询Blazor团队

<PropertyGroup>
<BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
</PropertyGroup>

相关内容

  • 没有找到相关文章