I'm using Visual Studio 2015 to publish my ASP.NET Core app to IIS 7.5. All I'm trying to do is view a normal default.htm page within my wwwroot. Everything works fine when I use VS's IIS Express, however when I publish is to IIS 7.5 and point the physical path to the wwwroot folder that Visual Studio created on publish, I get nothing but a blank screen (404). What's weird is when I run the default app.run method from within the Configure method of startup.cs, it works perfectly:
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
However, when I comment that out, use the app.UseDefaultFiles() and app.UseStaticFiles(), I get nothing. Here's my Startup.cs file:
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler();
//app.UseDirectoryBrowser();
//app.UseDefaultFiles();
//app.UseStaticFiles();
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
// Entry point for the application.
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
Here's my web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
</system.webServer>
</configuration>
And here's my project.json file:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
I've already made sure that I have httpPlatformHandler v1.2 downloaded, and when I publish from VS, I'm targeting DNX Version dnx-clr-winx86.1.0.0-rc1-update1 along with checkmarking the 2 options below (delete all existing files prior to publish, and compile source files into NuGet packages). It all runs fine in IIS Express. It's when I try to use IIS 7.5 is when it starts getting funky.
Any suggestions?
See Question&Answers more detail:
os