ASP.Net 核心 Angular2 模板加 Auth0 不工作
ASP.Net Core Angular2 template plus Auth0 not working
我正在尝试在 VS2015 中构建一个支持 Auth0 的 Angular2 网络前端。我使用了本文 http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/ and tried to follow the Auth0 guide for Angular2 at https://auth0.com/docs/quickstart/spa/angular2 中提到的模板,但我最终得到了无法启动的东西。它在我添加 Auth0 之前起作用,我认为这与我添加 Auth0 的方式有关,但我无法解决。我将在下面粘贴我当前的错误消息,但实际上是在尝试找到将 Auth0 添加到这个常见的 dotnet VS2015 模板所需的步骤。我正在使用这个特定的模板,因为它是主要的模板,似乎获得了所有主要功能,例如在 visual studio.
中工作的热代码更改
Exception: Call to Node module failed with error: ReferenceError: Auth0Lock is not defined
at new Auth (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\ClientApp\dist\main-server.js:230:26)
at AppView._View_AppComponent_Host0.createInternal (AppComponent_Host.ngfactory.js:15:20)
at AppView.create (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:9419:25)
at ComponentFactory.create (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6029:40)
at ApplicationRef_.bootstrap (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:7051:44)
at C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6960:93
at Array.forEach (native)
at PlatformRef_._moduleDoBootstrap (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6960:46)
at C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6928:31
at ZoneDelegate.invoke (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\zone.js\dist\zone-node.js:232:26)
原来是预渲染模块的问题。 Auth0 不支持预呈现。 Auth0 工作人员向我指出。(https://auth0.com/forum/t/asp-net-core-angular2-and-auth0-not-working/4170)
关键部分是通过从 Views/Home/Index.cshtml.
中的 <app>
元素中删除 asp-prerender-module 属性来禁用服务器端预呈现
我正在尝试在 VS2015 中构建一个支持 Auth0 的 Angular2 网络前端。我使用了本文 http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/ and tried to follow the Auth0 guide for Angular2 at https://auth0.com/docs/quickstart/spa/angular2 中提到的模板,但我最终得到了无法启动的东西。它在我添加 Auth0 之前起作用,我认为这与我添加 Auth0 的方式有关,但我无法解决。我将在下面粘贴我当前的错误消息,但实际上是在尝试找到将 Auth0 添加到这个常见的 dotnet VS2015 模板所需的步骤。我正在使用这个特定的模板,因为它是主要的模板,似乎获得了所有主要功能,例如在 visual studio.
中工作的热代码更改Exception: Call to Node module failed with error: ReferenceError: Auth0Lock is not defined
at new Auth (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\ClientApp\dist\main-server.js:230:26)
at AppView._View_AppComponent_Host0.createInternal (AppComponent_Host.ngfactory.js:15:20)
at AppView.create (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:9419:25)
at ComponentFactory.create (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6029:40)
at ApplicationRef_.bootstrap (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:7051:44)
at C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6960:93
at Array.forEach (native)
at PlatformRef_._moduleDoBootstrap (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6960:46)
at C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6928:31
at ZoneDelegate.invoke (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\zone.js\dist\zone-node.js:232:26)
原来是预渲染模块的问题。 Auth0 不支持预呈现。 Auth0 工作人员向我指出。(https://auth0.com/forum/t/asp-net-core-angular2-and-auth0-not-working/4170)
关键部分是通过从 Views/Home/Index.cshtml.
中的<app>
元素中删除 asp-prerender-module 属性来禁用服务器端预呈现