ASP.NET Core 1.1 fails to run when published

1

I had an ASP.NET Core application that I just went in an upgraded to 1.1. This application worked fine previously and I could publish it (through Publish Command in Visual Studio) and it worked fine under IIS. I recent changed this be 1.1 and got the application to run in debug mode fine. Now when I publish it I get

502 - Web server received an invalid response while acting as a gateway or proxy server.

I turned on Failed Request Tracing Rules and in there I see the following

MODULE_SET_RESPONSE_ERROR_STATUS 

ModuleName httpPlatformHandler 
Notification EXECUTE_REQUEST_HANDLER 
HttpStatus 502 
HttpReason Bad Gateway 
HttpSubStatus 3 
ErrorCode The server is currently disabled. (0x8007053d) 

My published web.config file looks like this

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <remove name="httpPlatform" />
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Cranalytics.dll" forwardWindowsAuthToken="true" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>

My project.json file looks like this

{
  "dependencies": {
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore": "1.1.0",
    "Microsoft.EntityFrameworkCore.InMemory": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",

    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",

    "Microsoft.Extensions.Caching.Memory": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",

    "Syncfusion.Compression.MVC": "14.2600.0.32-preview2-final",
    "Syncfusion.XlsIO.MVC": "14.2600.0.32-preview2-final",

    "Microsoft.ApplicationInsights.AspNetCore": "1.0.2",

    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",

    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },

    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
    //"net461": {
    //  "dependencies": {
    //  },
    //  "imports": "dnxcore50"
    //}
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config",
      "appsettings.Production.json",
      "appsettings.Staging.json",
      "appsettings.json"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

I can't find out what the problem is with the configuration or IIS.

Edit: I made some changes to configuration and am now past the module loading section (at least according to the Trace Log). Now I'm just getting 404 whenever I visit the website. I can view static images without a problem, but when I view the home page to the site I get a 404 error

ModuleName AspNetCoreModule 
Notification EXECUTE_REQUEST_HANDLER 
HttpStatus 404 
HttpReason Not Found 
HttpSubStatus 0 
ErrorCode The operation completed successfully. (0x0) 

My published directory structure is a sub site underneath the root site in IIS (/Cranalytics). Then in that folder is all of the various DLL, along with the web.config. Under this directory is the wwwroot directory from the project. The IIS subsite is set pointing to the root site (/Cranalytics).

c#
asp.net
iis
asp.net-core
asked on Stack Overflow Jan 18, 2017 by Paul Cavacas • edited Jan 19, 2017 by Paul Cavacas

2 Answers

0

Some Idea to Help.

1.Check Directory Browsing of your website if it is in enable state or not.
2.Try to separate your project to a new website with different port.
-also configure the newly created web site of course.
3.framework in application pool vs project, it must be the same.
answered on Stack Overflow Jan 19, 2017 by Vijunav Vastivch
0

The problem was this site was being update from RC1 to 1.1. To get RC1 to work there were several things that I needed to undo. In IIS when I created the site I had change the path from the root of the subsite Cranalytics to the wwwroot underneath that. This had to be undone.

Then in the Configure I needed to have something like this because it was a subsite. This had to be removed as well.

        //if (env.IsDevelopment())
        //{
        //    Configure1(app, env, loggerFactory, context);
        //}
        //else
        //{
        //    app.Map("/Cranalytics", app1 => Configure1(app1, env, loggerFactory, context));
        //}
answered on Stack Overflow Jan 19, 2017 by Paul Cavacas

User contributions licensed under CC BY-SA 3.0