【问题标题】:Aurelia CLI Run Command in ASP.NET Core Project Producing Only CannotGETASP.NET Core 项目中的 Aurelia CLI 运行命令仅生产无法获取
【发布时间】:2017-06-30 17:17:06
【问题描述】:

我创建了一个新的 ASP.NET Core Web API 项目,然后运行 ​​au new --here 命令选择选项 2(ASP.NET Core 项目)来创建 Web 应用程序的起点。

接下来我更新了 Startup.cs 文件以提供静态文件。

app.UseDefaultFiles();
app.UseStaticFiles();
app.UseFileServer();

最后我更新了 aurelia.json 文件以构建到 wwwroot 文件夹中。

"platform": {
    "id": "aspnetcore",
    "displayName": "ASP.NET Core",
    "output": "wwwroot/scripts",
    "index": "wwwroot/index.html",
    "baseUrl": "scripts"
},

"build": {
    "targets": [
      {
        "id": "aspnetcore",
        "displayName": "ASP.NET Core",
        "output": "wwwroot/scripts",
        "index": "wwwroot/index.html",
        "baseUrl": "scripts"
      }
],

Aurelia CLI 将很好地运行构建选项 (au build) 和运行选项 (au run),并将在 http://localhost:9000 上为站点提供服务。但我只得到以下 HTML:

<html><head></head><body>CannotGET /</body></html>

或者如果尝试引用http://localhost:9000/index.html

<html><head></head><body>CannotGET /index.html</body></html>

如果我通过 Visual Studio 和 IIS Express 运行应用程序,它可以正常工作。

为了让 au run 正常工作,我缺少什么?

我在 ASP.NET Core 1.0、1.1 以及 Visual Studio 2015 和 Visual Studio 2017 中得到了相同的结果。如果我在没有 --here 的情况下使用 au new 并且没有 ASP.NET Core 集成 au 运行就可以正常工作。

【问题讨论】:

    标签: asp.net-core aurelia


    【解决方案1】:

    我在 GitHub 上的一个问题中找到了答案:https://github.com/aurelia/cli/issues/405

    run.js 文件也需要更新路径。

    baseDir: ['./wwwroot'],
    

    【讨论】:

      猜你喜欢
      • 2021-10-25
      • 2020-04-15
      • 2018-01-29
      • 2017-01-05
      • 1970-01-01
      • 2021-12-21
      • 2017-11-18
      • 1970-01-01
      • 2017-05-31
      相关资源
      最近更新 更多