2017-03-03 77 views
1

將我的簡單應用程序作爲App Service部署到Azure時出現了一個非常奇怪的問題。該應用程序是ASP.NET Core和React前端。部署流程是這樣的:未在Visual Studio Team Services上執行ASP.NET Core發佈

  • 我的代碼,提交和推到開發分支
  • Visual Studio團隊服務拿起變化並開始構建過程:Build steps,例如發佈步數:log
  • 然後在成功構建之後,發佈過程將拾取工件並啓動Azure部署。
  • 其結果是:都已經有了前幾天的工作,但現在web.config中沒有與IIS集成工具轉化,因此其被留在其原始狀態:

<!-- 
    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> 

因此,當您嘗試通過url訪問應用程序服務時,它會因爲錯誤502而崩潰。我通過訪問應用程序服務文件並手動更改web.config來驗證該應用程序是否正確地使用正確的web.config。我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%" ] 
    } 
} 

的事情是:當我使用Visual Studio在本地發佈的應用程序,一切都很好,在web.config是正確的,應用程序的工作。

最後,問題:出了什麼問題?在之前,我想留在這個版本的SDK中,但如果沒有其他選項,我會考慮更新。非常感謝您的任何建議!

+0

您是否注意到生成日誌結尾處的錯誤?未處理的異常:System.IO.FileNotFoundException:無法加載文件或程序集'Microsoft.Extensions.CommandLineUtils,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = adb9793829ddae60'。該系統找不到指定的文件。 2017-03-03T07:20:29.4468824Z at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.Main(String [] args) 2017-03-03T07:20:30.4738821Z ##結束語:dotnet發佈''' –

+0

嘿!說實話,我沒有注意到,不知道爲什麼。爲什麼該組件缺失?我之前並沒有將它包含在project.json中,它工作,不知道爲什麼現在它是一個問題。你有什麼主意嗎? –

+0

你能用一個新的簡單項目重現這個問題嗎? –

回答

0

改爲使用Microsoft.AspNetCore.Server.IISIntegration.Tools 1.0.0-preview2-final。相關主題:Visual Studio Team Services asp.net core build for IIS

+0

嘿,我已經在使用這個版本了。看看project.json –

+0

@RichardRahl你使用託管代理還是使用託管代理? –

+0

starain-MSFT:託管代理 –

相關問題