Scott Kuhl
Scott Kuhl

Reputation: 1081

Aurelia CLI Run Command in ASP.NET Core Project Producing Only CannotGET

I have created a new ASP.NET Core Web API project and then run the au new --here command selecting option 2 (ASP.NET Core Project) to create a starting point for a web application.

Next I updated the Startup.cs file to serve static files.

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

Finally I updated the aurelia.json file to build into the wwwroot folder.

"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"
      }
],

The Aurelia CLI will run the build option (au build) and the run option (au run) fine and it will serve up the site on http://localhost:9000. But I get only the following HTML served up:

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

or if trying to reference http://localhost:9000/index.html

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

If I run the application through Visual Studio and IIS Express it works fine.

What am I missing to get au run to work?

I have the same result with ASP.NET Core 1.0, 1.1 and in Visual Studio 2015 and Visual Studio 2017. If I use au new without the --here and no ASP.NET Core integration au run will work just fine.

Upvotes: 2

Views: 389

Answers (1)

Scott Kuhl
Scott Kuhl

Reputation: 1081

I found the answer buried in an issue on GitHub: https://github.com/aurelia/cli/issues/405

The run.js file need to also have the path updated.

baseDir: ['./wwwroot'],

Upvotes: 1

Related Questions