asp.net - Visual Studio 2017 Angular 6 显示 "Cannot Get/"仅限首次尝试

标签 asp.net angular visual-studio-2017 angular6 asp.net-core-2.1

我将 Visual Studio 2017 15.8.3 与 .Net Core 2.1 和 Angular 6 一起使用。我使用模板创建项目并将其从 Angular 5 升级到 6。它按预期运行。我删除了模板代码并添加了我自己的代码。随着我添加更多代码,我开始收到 Cannot GET/消息;但是,如果我进入任何 .ts 文件并保存它,刷新浏览器,一切都会重新加载并按预期出现。没有错误显示。我看不到任何问题。

我在启动时有这个

    app.UseSpa(spa =>
    {
        // To learn more about options for serving an Angular SPA from ASP.NET Core,
        // see https://go.microsoft.com/fwlink/?linkid=864501

        spa.Options.SourcePath = "ClientApp";

        if (env.IsDevelopment())
        {
            spa.Options.StartupTimeout = new TimeSpan(0, 0, 360);
            spa.UseAngularCliServer(npmScript: "start");
            spa.UseProxyToSpaDevelopmentServer("https://localhost:4200");
        }
    });

我很难过。

谢谢, 保罗

最佳答案

好吧,这有点尴尬,但我把它留在这里以防万一有人遇到同样的问题但无法解决。

我从一个原型(prototype)项目中复制了一堆代码,但遗漏了一个不明显的文件。我是怎么找到它的? Visual Studio 中的输出窗口!其他工具均未显示任何内容。

Microsoft.AspNetCore.SpaServices:Error: ERROR in src/app/models/user-configuration.model.ts(1,36): error TS2307: Cannot find module './functional-ability.model'.

所以我想这里的教训是:

  • Cannot GET/ 好像是在告诉你少了什么

  • Visual Studio Output windowError List 是您在这些以及许多其他情况下的伙伴。

关于asp.net - Visual Studio 2017 Angular 6 显示 "Cannot Get/"仅限首次尝试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52225998/

相关文章:

c# - 根据字符串访问特定标签

c# - 在发送到 Controller/DB 之前编码 HTML

c# - 使用 Microsoft 技术 (SSDT) 自动进行数据库架构比较

c# - 如何防止在 ASP.Net Web Forms (Identity) 中注册后自动登录?

asp.net - 如何在 Azure 中启动 ASP.Net 状态服务

php - 错误错误 : Uncaught (in promise): TypeError: users is undefined

css - Bootstrap 4 导航栏不会在 Angular4 中崩溃

angular - Angular 中的 StaticInjector 与 ReflectiveInjector

c# - 从我的项目文件创建新的 docker 镜像时出错

visual-studio - 如何防止在 Visual Studio 2017 中创建 launchSettings.json