简体   繁体   中英

ASP.NET Core post-publish not executed on Visual Studio Team Services

I have a pretty weird problem with deploying my simple application to Azure as App Service. The application is ASP.NET Core and React front-end. The deployment flow looks like this:

  • I code, commit and push to development branch
  • Visual Studio Team Services picks up the changes and start building process: Build steps , example publish step log: log
  • Then after successful build, the release process picks up the artifacts and start Azure deploy.
  • As a result: all already had worked a few days ago, but now web.config is not transformed with IIS integration tools, so its being left in its pristine state:

  <!--
    Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
  -->

  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
  </system.webServer>
</configuration>

So, when you try to access the app service via url, it crashes with error 502 as a result. I verified by accessing the app service files and changing web.config by hand, that the application works fine with the correct web.config. My project.json:

{
    "dependencies": {
        "Autofac.Extensions.DependencyInjection": "4.0.0",
        "AutoMapper": "5.2.0",
        "AutoMapper.Extensions.Microsoft.DependencyInjection": "1.2.0",
        "HumanAction.Historykon.Configuration": "1.0.0-*",
        "HumanAction.Historykon.DataAccessLayer": "1.0.0-*",
        "HumanAction.Historykon.Domain": "1.0.0-*",
        "Microsoft.ApplicationInsights.AspNetCore": "2.0.0",
        "Microsoft.AspNetCore.Cors": "1.0.1",
        "Microsoft.AspNetCore.Mvc": "1.0.1",
        "Microsoft.AspNetCore.Routing": "1.0.1",
        "Microsoft.AspNetCore.Server.IISIntegration": "1.0.1",
        "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
        "Microsoft.EntityFrameworkCore": "1.0.1",
        "Microsoft.EntityFrameworkCore.Design": {
            "version": "1.0.1",
            "type": "build"
        },
        "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
        "Microsoft.EntityFrameworkCore.Tools": {
            "version": "1.0.0-preview4-final"
        },
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.1",
        "Microsoft.Extensions.Configuration.FileExtensions": "1.0.1",
        "Microsoft.Extensions.Configuration.Json": "1.0.1",
        "Microsoft.Extensions.Logging": "1.0.1",
        "Microsoft.Extensions.Logging.Console": "1.0.1",
        "Microsoft.Extensions.Logging.Debug": "1.0.1",
        "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.1",
        "Microsoft.NETCore.App": {
            "version": "1.0.1",
            "type": "platform"
        }
    },

  "tools": {
            "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
                            "version": "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",
      "**/*.cshtml",
      "appsettings.json",
      "appsettings.Dev.json",
      "appsettings.Qa.json",
      "appsettings.Live.json",
      "web.config"
    ]
  },

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

The thing is: when I publish the application locally with Visual Studio, all is well, the web.config is correct, the application works.

Finally, the question: what went wrong? In before, I would like to stay in this version of sdk, but if there's no other option I will consider updating. Thanks a lot for any suggestions!

Using Microsoft.AspNetCore.Server.IISIntegration.Tools 1.0.0-preview2-final instead. Related thread: Visual Studio Team Services asp.net core build for IIS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM