aspnet / vsweb-publish

Web publish support for ASP.NET 5 in Visual Studio 2015
Other
33 stars 22 forks source link

publish seemingly goes well but produces Bad Gateway (502) Errors in Azure #59

Open Lutando opened 8 years ago

Lutando commented 8 years ago

I am trying to get my publish to work from the publish-default.ps1 script and this is what I am doing to get this error. I have The Core SDK and Tooling updates on Visual Studio 2015.

Project -> New ASP.NET Core Web Application (.NET Framework) -> WebApi

dotnet publish -o C:/PublishDirectory PublishAspnetWebsite.ps1 -websiteName mywebsite -packOutput C:/PublishDirectory

I got publish AspNetWebsite.ps1 from here and I have updated my default-publish.ps1 script to the one on this repo (version 1.1.1) and I have put publish-module.psm1 in a folder called 1.1.1 on the same root as the default-publish.ps1 script

Any help appreciated

vijayrkn commented 8 years ago

Can you turn on logging to see what is the error? On the server web.config, you can set logging to true

<aspNetCore processPath="dotnet" arguments=".\webapp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />

sayedihashimi commented 8 years ago

TFS: 224912 I've added this to our internal TFS, we will reply back here soon.

Lutando commented 8 years ago

This is the full error I get

502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

davenewza commented 8 years ago

@sayedihashimi any news on this issue? Even a workaround would be great. It's a serious issue which is preventing from pushing RC2 to Azure.

vijayrkn commented 8 years ago

@davenewza - Can you share your web.config and project.json?

cc @moozzyk

Lutando commented 8 years ago

@vijayrkn we made our own workaround to ftp the app files into the site folder on the azure webapp VM

In RC1 projects and prior we never had to do this, we just used the vs publish scripts.

Would be nice if the vs publish web script did this as well though.

Foritus commented 8 years ago

I am also experiencing this (with the RTM build of dotnet). Files attached. project.json.txt web.config.txt

Update: Disregard, found out it was a crash on boot that only happened when running in Azure. Hard to find the cause of these things, but definitely my fault :-)

moozzyk commented 8 years ago

Check event log, Also take a look at this post: https://blog.3d-logic.com/2016/06/08/running-asp-net-core-applications-with-iis-and-antares/. The troubleshooting section tells you how to diagnose this kind of errors.

guardrex commented 8 years ago

@Malediction Did you make a manual change to your web.config for the processPath and arguments? That's not what the publish iis tooling sets up for this type of app.

@moozzyk It probably shouldn't matter from a implementation standpoint, as dotnet.exe is capable of handling the .exe in arguments, but could you comment about dotnet.exe combined with the .exe in arguments? ... Is it okey-dokey :+1: ... or is it to be avoided on pain of :skull: death :skull: :-1:? What's the scoop?

He ended up with ...

<aspNetCore 
    processPath="dotnet" 
    arguments="CollageBot.exe" 
    ... />

... but tooling for this app would ordinarily lead to ...

<aspNetCore 
    processPath=".\CollageBot.exe" 
    ... />
moozzyk commented 8 years ago

From what I can see it's a desktop .NET (and not .NET Core) app so it should never be started using dotnet. publish-iis should detect this so it's either a bug (in which case I would need a repro because we have tests for this scenario and they pass) or this is not publish-iis that created this config.

Foritus commented 8 years ago

It's an aspnet 4.6.2 app. Sorry for the red herring in web.config, that was someone trying out different launch params as $Random_Internet_Blog suggested the launch param environment variables might not be set. In the end we ditched aspnet core and went back to "regular"/"classic" asp.net.

tek-shiro commented 4 years ago

I am still facing 502 error randomly.

PS - Background job runners also add to this problem. For me once it was caused by multiple Hangfire servers .