【发布时间】: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