加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

“使用Angular2和ASP.NET调用节点模块失败并出现错误”

发布时间:2020-12-17 07:49:03 所属栏目:安全 来源:网络整理
导读:我的ASP.NET Core Angular 2网络应用程序出现间歇性异常: Exception: Call to Node module failed with error: Error: This method is not implemented in Parse5DomAdapter: Parse5DomAdapter#getCookie at _notImplemented (D:ProjectsMyProjectMyProj
我的ASP.NET Core Angular 2网络应用程序出现间歇性异常:
Exception: Call to Node module failed with error: Error: This method is not implemented in Parse5DomAdapter: Parse5DomAdapter#getCookie
 at _notImplemented (D:ProjectsMyProjectMyProjectnode_modulesangular2-platform-nodeparse5-adapter.js:22:12)
 at Parse5DomAdapter.getCookie (D:ProjectsMyProjectMyProjectnode_modulesangular2-platform-nodeparse5-adapter.js:641:15)
 at CookieXSRFStrategy.configureRequest (D:ProjectsMyProjectMyProjectnode_modules@angularhttpbundleshttp.umd.js:1597:92)
 at XHRBackend.createConnection (D:ProjectsMyProjectMyProjectnode_modules@angularhttpbundleshttp.umd.js:1637:32)
 at httpRequest (D:ProjectsMyProjectMyProjectnode_modules@angularhttpbundleshttp.umd.js:1975:24)
 at Http.get (D:ProjectsMyProjectMyProjectnode_modules@angularhttpbundleshttp.umd.js:2086:20)
 at ApiService.getChatMessages (D:ProjectsMyProjectMyProjectClientAppdistmain-server.js:557:20)
 at ChatPageComponent.ngOnInit (D:ProjectsMyProjectMyProjectClientAppdistmain-server.js:513:23)
 at AppView._View_ChatPageComponent_Host0.detectChangesInternal (ChatPageComponent_Host.ngfactory.js:30:86)
 at AppView.detectChanges (D:ProjectsMyProjectMyProjectnode_modules@angularcorebundlescore.umd.js:9566:18)

MoveNext

我相信它与MVC视图有关,因为错误显示:

MoveNext in Index.cshtml

1.@{
2.    ViewData["Title"] = "Home Page";
3.}
4.
5.<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
6.
7.<script src="~/dist/vendor.js" asp-append-version="true"></script>
8.@section scripts {

这是我的index.cshtml中的代码.

这似乎发生在项目启动后的早期.这一切都可以正常工作,或者在执行任何导航时加载主页后会抛出错误.

我可以强迫它产生错误.我有4个导航目的地:

http://localhost:49954/home
http://localhost:49954/counter
http://localhost:49954/fetch-data
http://localhost:49954/chat-page

这些都是从Visual Studio Angular 2模板设置的.如果我刷新回家,一切都很好,如果它有机会加载一段时间我可以导航到其他页面.但是,如果我输入任何其他页面的URL,则每次都会产生此错误.

编辑:另外,有趣的是,它与http:// localhost:49954 / counter产生了略微不同的错误.在我的计数器页面中,我使用了Angular Material Design组件:

<div class="mine">
    <h2>
        Counter Test
    </h2>
    <p>This is a simple example of an Angular 2 component.</p>
    <p>Current count:<strong>{{ currentCount }}</strong></p>
    <button md-raised-button (click)="incrementCounter()">Increment</button>
</div>

而不是上面的错误,它是一个类似的调用节点模块失败错误,但在材料设计中:

Exception: Call to Node module failed with error: Error: Uncaught (in promise): ReferenceError: document is not defined
 ReferenceError: document is not defined
 at new RippleRenderer (D:ProjectsMyProjectMyProjectnode_modules@angularmaterialmaterial.umd.js:193:31)
这对我有用.更改:
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>

<app asp-ng2-prerender-module="ClientApp/dist/main-server">Loading...</app>

在index.html中

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读