Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

net core basic project is not serving any page!

$
0
0

Hi all:

I am doing a very basic course of .net core, I have created an empty .net core project and started to configure it to see how it works.

This is what I did

1) I created a page "index.html" inside of the folder wwwroot. 

2) Modified the method Configure of the class Startup.cs, now it looks like this:

 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
   loggerFactory.AddConsole();

   if (env.IsDevelopment())
   {
      app.UseDeveloperExceptionPage();
   }

   app.Run(async (context) =>
   {
     app.UseStaticFiles();
  });
}

so basicalley I added: 

app.UseStaticFiles();

to serve pages.

3) I added the nuget package for that line, and here is how my project.json looks like (so I added: "Microsoft.AspNetCore.StaticFiles": "1.0.0"):

{"dependencies": {"Microsoft.NETCore.App": {"version": "1.0.1","type": "platform"
    },"Microsoft.AspNetCore.Diagnostics": "1.0.0","Microsoft.AspNetCore.Server.IISIntegration": "1.0.0","Microsoft.AspNetCore.Server.Kestrel": "1.0.1","Microsoft.Extensions.Logging.Console": "1.0.0","Microsoft.AspNetCore.StaticFiles": "1.0.0"
  },"tools": {"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },"frameworks": {"netcoreapp1.0": {"imports": ["dotnet5.6","portable-net45+win8"
      ]
    }
  },"buildOptions": {"emitEntryPoint": true,"preserveCompilationContext": true
  },"runtimeOptions": {"configProperties": {"System.GC.Server": true
    }
  },"publishOptions": {"include": ["wwwroot","web.config"
    ]
  },"scripts": {"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

So the issue is that when I go to this url: http://localhost:9966/index.html

nothing happens, it doesn't load the page, in the browser console I don't see any error at all.

Note: I have installed some web package add in, before the url port was 5000 now is different, but the issue was there before anyway.

Thanks,

Marcos


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>