【问题标题】:Asp.net Core 2 - Angular template (One Solution)Asp.net Core 2 - Angular 模板(一种解决方案)
【发布时间】:2018-07-24 22:14:18
【问题描述】:

在下载 ASP.NET Core with Angular One 解决方案模板后,我在启动项目时遇到了一些问题。 我用 iis express 启动它,但客户端应用程序没有启动。 https://aspnetboilerplate.com/Pages/Documents/Zero/Startup-Template-Core 有什么建议吗?

【问题讨论】:

  • 你有没有按照这里提到的步骤aspnetzero.com/Documents/Getting-Started-Angular
  • 是的,但是即使 Angular 应用程序位于后端的同一个项目中,它也不会运行...
  • 你想运行什么?主持人?
  • 它只从控制台“npm start”开始。我可以在 Visual Studio IIS Express 中同时启动 Angular 应用程序和后端吗?
  • 您应该使用 npm start 运行 Angular 应用程序。它不能像使用 Visual Studio 的后端代码一样运行

标签: aspnetboilerplate


【解决方案1】:

您无法从 VS 运行/调试 Angular 项目。因为 Angular 项目是使用 Angular-CLI 运行的。对于调试检查以下链接。

  1. How to debug Angular JavaScript Code
  2. https://www.pluralsight.com/guides/front-end-javascript/debugging-angular-2-applications

尝试使用 Visual Studio Code 并添加 Chrome debugging 扩展并将配置添加到 launch.json 类似这样的内容。

{  
    "version": "0.2.0",  
    "configurations": [{  
        "name": "Launch Chrome against localhost",  
        "type": "chrome",  
        "request": "launch",  
        "url": "http://localhost:4200",  
        "sourceMaps": true,  
        "webRoot": "${workspaceRoot}",  
        "sourceMapPathOverrides": {  
            "webpack:///./*": "${workspaceRoot}/*"  
        }  
    }]  
}

您也可以参考此文档了解更多详细信息。 https://code.visualstudio.com/docs/languages/typescript

【讨论】:

    【解决方案2】:

    合并解决方案是 Angular 和宿主项目文件位于同一目录中的结构。这并不意味着主机和客户端应用程序在 IIS Express 中启动。所以你不能在 IIS Express 中运行 Angular。只需运行npm start

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-29
      • 2019-10-11
      • 1970-01-01
      • 2021-10-10
      • 2012-02-15
      • 2011-10-11
      • 2017-10-17
      • 2018-05-18
      相关资源
      最近更新 更多