首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Blazor Hosted WebApp -发布后出错

Blazor Hosted WebApp -发布后出错
EN

Stack Overflow用户
提问于 2020-10-24 00:01:16
回答 1查看 420关注 0票数 2

我已经开始使用托管模型学习Blazor Webassembly。

在本地,我可以使用visual studio代码创建并运行一个简单的Blazor web应用程序。

但是,当我发布(在本例中是www.myasp.net)时,任何页面上都会出现以下脚本错误:

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer100未处理的异常呈现组件:意外的token <位置0的JSON中的SyntaxError:意外的token <位置0的JSON中的Microsoft.JSInterop.JSException:意外的token <位置0的JSON中的SyntaxError:意外的token <位置0处的JSON () <0x21ea748 + 0x0002c> in :0 at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync (Microsoft.JSInterop.IJSRuntime jsRuntime,System.String identifier,System.Object[] args) <0x2010058 + 0x000e4> in :0 at

谢谢

下面是完整的错误:

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer100未处理的异常呈现组件:意外的token <在位置0的JSON中SyntaxError:意外的token <在位置0的JSON中Microsoft.JSInterop.JSException:意外的token <在位置0的JSON中SyntaxError:意外的token <在位置0的JSON中TAccount,TProviderOptions.EnsureAuthService () <0x20084c0 + 0x000ee> in :0 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3[TRemoteAuthenticationState,TAccount,TProviderOptions].GetAuthenticatedUser () <0x2007c20 + 0x000d2> in <filename unknown>:0 at System.Threading.Tasks.ValueTask1TResult.get_Result () <0x21ebf88 + 0x0002c> in :0 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3[TRemoteAuthenticationState,TAccount,TProviderOptions].GetUser (System.Boolean useCache) <0x1fcb190 + 0x00136> in <filename unknown>:0 at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService3TRemoteAuthenticationState,TAccount,Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion () <0x1fc9ff0 + 0x000d0> in :0 at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync () <0x2135338 + 0x0012e> in :0 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion (System.Threading.Tasks.Task任务) <0x2135d90 + 0x000ee> in :0 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x1f67eb0 + 0x0020c> in :0 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x21391a0 + 0x000ca> in :0

EN

回答 1

Stack Overflow用户

发布于 2021-05-17 22:23:48

是,

  1. 主机提供商授予应用程序池对根文件夹( wwwroot文件夹下的文件夹)的完全访问权限,这为我解决了问题。

  1. 由于我强制我的网站使用https,因此我还必须使用私钥获取证书的.pfx副本-然后将其包含在appsettings.json文件

代码语言:javascript
复制
  "IdentityServer": {
    "Clients": {
      "xxxxxxxxx.Client": {
        "Profile": "IdentityServerSPA"
      }
    },

    "Key": {
      "Type": "File",
      "FilePath": "xxxxxxxxx.pfx",
      "Password": "xxxxxxxxx"
    }      
  }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64503461

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档