Last post Oct 20, 2017 05:53 AM by Zhi Lv - MSFT
Oct 18, 2017 08:45 PM|f.a.rodriguez|LINK
I have created an ASP.Net Core 2.0 Web Api. It works perfectly in Visual Studio. But when I deploy it, I get the following error when I try to call any of its endpoints:
HTTP Error 502.5 - Process Failure
In Chrome's console, there is no extra info. However, in Edge's console, it says:
HTTP502: BAD GATEWAY - The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
GET - http://www.eball.co.za/api/values
I am hosting on a shared Windows hosting package.
This is the Web.config file that Visual Studio generates when it deploys the app (via FTP)
<?xml version="1.0" encoding="utf-8"?>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
<aspNetCore processPath="dotnet" arguments=".\eBall.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
And this is the project's .csproj file:
<Folder Include="Data\" />
<Folder Include="Models\" />
<Folder Include="Views\Shared\" />
<Folder Include="wwwroot\" />
<Folder Include="wwwroot\css\" />
<Folder Include="wwwroot\images\" />
<Folder Include="wwwroot\js\" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
I am deploying this to ftp://eball.co.za/httpdocs/api
I can log into my host providers Plesk Control Panel and view the logs. However, all it shows is this:
I can't open any of this line items though...
Any ideas anyone? I've spent all week trying to figure this one out... :(
Oct 19, 2017 01:25 AM|DA924|LINK
Yeah, it worked perfectly with VS, because you were testing against IIS Express with IIS Express not being the real IIS. So when you deployed to the real IIS, it has things that IIS Express doesn't expose and down it goes.
What you should do is use local IIS, the real IIS, on your local machine and test the Web solution using VS in debug mode using the Web project code against local IIS.
1) right-click Web project in VS
2) go to Properties
3) go to Web Tab
4) select local IIS
5) press the 'create virtual directory' button
VS must be running with 'run as administrator' before doing steps 1-5
The Web project is now deployed to local IIS, and VS can be used in debug mode to debug the source code against local IIS
Oct 19, 2017 06:12 AM|f.a.rodriguez|LINK
Thanks for the quick reply DA924. I right-clicked on the project and went to properties, but I don't have the "Web" tab you mention. Could this be because this project is a Web API?
This is what my Application tab loks like:
and the Debug tab:
Don't know if that helps...
Oct 19, 2017 08:58 AM|DA924|LINK
Oct 19, 2017 01:06 PM|DA924|LINK
After doing a WebAPI Core project, it's different than the traditional ASP.NET Web project in how you can tell VS with a traditional ASP.NET Web project to deploy project to local IIS for debug purposes.
You have to look up MSDN documentation concerning VS and Core Web type project on how to configure the project to use local IIS and not IIS Express for debugging of solution against local IIS.
Oct 19, 2017 01:11 PM|f.a.rodriguez|LINK
Hi DA924. Yes, I also noticed it shows the output type as "Console Application", but I guarantee you it's a Web API project.
Ok thanks will check out the MSDN documentation now to see how to do it.
Oct 20, 2017 05:53 AM|Zhi Lv - MSFT|LINK
Here are some relevant articles about host Asp.net core 2.0 on IIS, you could refer them: