I've a very similar scenario to this question, namely I want a static file server which serves an index.html as the base of my angular app.
However when I try to access the page, I get the "This webpage is not available" ERR_CONNECTION_REFUSED error in Chrome.
I took a peek in fiddler, where the error is:
[Fiddler] The connection to 'localhost' failed.
Error: ConnectionRefused (0x274d).
System.Net.Sockets.SocketException No connection could be made
because the target machine actively refused it 127.0.0.1:3340
I did the following:
Created a new Empty ASP.NET 5 Template.
Added an empty index.html to the wwwroot folder.
Added the following code to the Startup.cs:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseIISPlatformHandler();
app.UseFileServer();
}
The project.json file contains the following dependencies:
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc2-15978"
},
while the global.json is
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-rc1-final"
}
}
The strange thing is that if I create an MVC project, then replace its complete Startup.cs code with the two lines above it works like a charm.
So the question is: what do I need to make this work when I'm using an Empty template?