cloudfoundry / hwc-buildpack

Cloud Foundry buildpack for Hosted Web Core
http://docs.cloudfoundry.org/buildpacks/
Apache License 2.0
13 stars 19 forks source link

ASp.Net Core Application throws 403 error when deployed on PCF with hwcbuild pack #3

Closed abhijitpatil1009 closed 7 years ago

abhijitpatil1009 commented 7 years ago

Hi ,

I am deploying Asp.net Core application pcf environment with hwc_buildpack, I am using cf push webapp -s windows2012R2 -b hwc_buildpack -p ./ command, also refer below url and added changes as mentioned there. https://docs.pivotal.io/pivotalcf/1-10/buildpacks/dotnet-core/index.html also added manifest file with required configurations.Currently, I am getting 403 error on hitting url of deployed application in browser. Please let me know is it(hwc_buildpack )supports Asp.net Core or not? If it support then what are required changes I have to add in it,to make it accessible.

Help Much appreciated!! Thanks, Abhijit Patil.

cf-gitbot commented 7 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/145591927

The labels on this github issue will be updated when the story is started.

awmartin commented 7 years ago

The HWC Buildpack is intended only for full .NET Framework (e.g. ASP.NET) applications deployed on Windows cells. It does not support .NET Core applications and was not designed to.

We highly recommend pushing .NET Core applications to Linux VMs with the .NET Core Buildpack, as mentioned in the doc you linked to. Note the lack of the -s windows2012R2 flag in the push command:

cf push webapp -b https://github.com/cloudfoundry/dotnet-core-buildpack.git

It is possible to push .NET Core applications to Windows Cells, if built properly, but there shouldn't be any significant reason to.

abhijitpatil1009 commented 7 years ago

Thanks Allen, Thanks for immediate response , it really help me for my understanding and proceed further. Currently, I am able to deploy ASP.Net Applications on PCF hwc_buildpack and trying to connect with PCF MySql Database as bounded service in application, however not able connect with it. Is there any special configuration apart from connection string we must have to add in web config? Please guide if you have an experience with PCF MySql DB connection with Asp.net application. One more thing I have to clarify from you, can deploy and use .NetCore WebAPI as well on asp.net core buildpack on linux VM. I found there are least documentation for Asp.net core and ASP.Net on PCF deployment. Please help me if you have any suggestion for to follow urls/documentations.

Big Thanks!!

Abhijit Patil.

sclevine commented 7 years ago

The .NET Core buildpack runs on Linux VMs, and is documented here: https://github.com/cloudfoundry/dotnet-core-buildpack http://docs.cloudfoundry.org/buildpacks/dotnet-core/index.html

The HWC buildpack runs on Windows VM, and is not yet fully documented: https://github.com/cloudfoundry-incubator/hwc-buildpack

@awmartin any ideas about MySQL in traditional .NET apps on Windows?

sclevine commented 7 years ago

Closing this due to inactivity.

sclevine commented 7 years ago

Update to this issue: it is possible to run .NET Core apps on Windows by pre-publishing them and pushing them using the binary buildpack, which now supports Windows.

egmanoharan commented 6 years ago

Update to this issue: it is possible to run .NET Core apps on Windows by pre-publishing them and pushing them using the binary buildpack, which now supports Windows

Please let me the pre-publishing steps to run the .net core app in windows stack.

dgodd commented 6 years ago

@egmanoharan The same as you would if you were planning to run the code on a windows machine yourself. The simple answer for a basic dotnet-core app would be.

dotnet publish --runtime win-x86 -c Release

and then push the resulting published files from the bin/Release/netcoreapp2.0/win-x86/publish directory, (or similar)

egmanoharan commented 6 years ago

Hi Dave Goddard,

I have published the .Net Core 2.0 Application with the command "dotnet publish --runtime win-x86 -c Release" & pushed the resulting published files using binarybuildpack [v1.0.13]. Got a ERR Warning to specify the start command. >> 2017-12-04T12:07:59.52+0530 [APP/PROC/WEB/0] ERR Warning: We detected a Web.config in your app. This probably means that you want to use the hwc-buildpack. If you really want to use the binary-buildpack, you must specify a start command.

_

I have specified the start command in the manifest.yml file "command: .\AppName.exe" The application is pushed & running successfully , however while access it getting "502 Bad Gateway: Registered endpoint failed to handle the request.

Thanks & Regards, Mano

greenhouse-ci commented 6 years ago

I think there may be some confusion about how to deploy ASP.NET Core to CF.

First, ASP.NET Core can be built either against .NET Core or .NET Framework. If the former, the normally way this happens is to deploy onto Linux Diego cells using the .NET Core Buildpack.

If you built against .NET Framework instead, you can deploy to Windows VMs using the HWC Buildpack.

Can you please verify what you’re trying to do?

On Sun, Dec 3, 2017 at 11:32 PM egmanoharan notifications@github.com wrote:

Hi Dave Goddard,

I have published the .Net Core 2.0 Application with the command "dotnet publish --runtime win-x86 -c Release" & pushed the resulting published files using binarybuildpack [v1.0.13]. Got a ERR Warning to specify the start command. >> 2017-12-04T12:07:59.52+0530 [APP/PROC/WEB/0] ERR Warning: We detected a Web.config in your app. This probably means that you want to use the hwc-buildpack. If you really want to use the binary-buildpack, you must specify a start command.

_

I have specified the start command in the manifest.yml file "command: .\AppName.exe" The application is pushed & running successfully , however while access it getting "502 Bad Gateway: Registered endpoint failed to handle the request.

Thanks & Regards, Mano

— You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub https://github.com/cloudfoundry/hwc-buildpack/issues/3#issuecomment-348881511, or mute the thread https://github.com/notifications/unsubscribe-auth/AMuKrl2nqX2XXEE0NqWt6ShwBrFBMoHnks5s85_2gaJpZM4NdxBy .

dgodd commented 6 years ago

My guess is that you aren't listening on $PORT

On Mon, Dec 4, 2017, 4:23 PM greenhouse-ci notifications@github.com wrote:

I think there may be some confusion about how to deploy ASP.NET Core to CF.

First, ASP.NET Core can be built either against .NET Core or .NET Framework. If the former, the normally way this happens is to deploy onto Linux Diego cells using the .NET Core Buildpack.

If you built against .NET Framework instead, you can deploy to Windows VMs using the HWC Buildpack.

Can you please verify what you’re trying to do?

On Sun, Dec 3, 2017 at 11:32 PM egmanoharan notifications@github.com wrote:

Hi Dave Goddard,

I have published the .Net Core 2.0 Application with the command "dotnet publish --runtime win-x86 -c Release" & pushed the resulting published files using binarybuildpack [v1.0.13]. Got a ERR Warning to specify the start command. >> 2017-12-04T12:07:59.52+0530 [APP/PROC/WEB/0] ERR Warning: We detected a Web.config in your app. This probably means that you want to use the hwc-buildpack. If you really want to use the binary-buildpack, you must specify a start command.

_

I have specified the start command in the manifest.yml file "command: .\AppName.exe" The application is pushed & running successfully , however while access it getting "502 Bad Gateway: Registered endpoint failed to handle the request.

Thanks & Regards, Mano

— You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub < https://github.com/cloudfoundry/hwc-buildpack/issues/3#issuecomment-348881511 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AMuKrl2nqX2XXEE0NqWt6ShwBrFBMoHnks5s85_2gaJpZM4NdxBy

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cloudfoundry/hwc-buildpack/issues/3#issuecomment-349110205, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHtTWi3qHJVvOxu2PjSdYSfS8P7xKrkks5s9GLGgaJpZM4NdxBy .

lairtonb commented 6 years ago

For me it works adding Steeltoe (https://steeltoe.io/docs/steeltoe-configuration/):

using Steeltoe.Extensions.Configuration.CloudFoundry;

then:

    public static IWebHost BuildWebHost(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .CaptureStartupErrors(true)
            .UseStartup<Startup>()

            // Enable the application to listen on port(s) provided by the environment at runtime
            .UseCloudFoundryHosting()

            // Add VCAP_* configuration data
            .AddCloudFoundry()

            .Build();

With sample manifest like this:


applications:

--urls should workd as well: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/web-host?view=aspnetcore-2.1#override-configuration