C. Daniel February 2016

Visual Studio 2015 www local project only showing Hello World

I'm trying to create a basic Aurelia app using VS2015. I was able to properly jspm install all the files I needed and I created by app.js and app.html and index.html files but when I try to run the app to see my hardcoded text all I see is 'Hello World!' in my browser. I try to change the text to anything else but it keeps coming back Hello World. I followed the example from Scott Allen on PluralSight. His pull sup fine but I cannot. Can anyone tell me what I'm doing wrong? How do I get my index.html and not whatever is showing the Hello World text? My table structure is as such

Solution
    |_Solution Items
      |_ global.json
    |_src
      |_ Demo
        |_ Properties
        |_ References
        |_ wwwroot
           |_ jspm_packages
           |_ app.html
           |_ app.js
           |_ index.html
           |_ config.js
        |_ Dependencies
        |_ package.json
        |_ project.json
        |_ Startup.cs

Answers


GraemeMuir February 2016

If you are creating an ASP.NET V5 application you may not have set the solution to be able to serve static files.

In the startup.cs there is a configure method where you will need to enable using static files. My configure method ending up looking like this in order to work.

public void Configure(IApplicationBuilder app)
{
    app.UseIISPlatformHandler();
    app.UseDefaultFiles();
    app.UseStaticFiles();

    app.Run(async (context) =>
    {
        await context.Response.WriteAsync("Hello World!");
    });
 }

In the project.json I also had to add a dependency of

"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"

Post Status

Asked in February 2016
Viewed 1,374 times
Voted 13
Answered 1 times

Search




Leave an answer