locked
I tried deploying my API but it doesn't work. RRS feed

  • Question

  • User-309436090 posted

    Hi,

    Ok, this my very last attempt to deploy my API written in .NET 5.0. I have tried so many things that I am slowly approaching to a point where I shall just give the hell up.

    This is my project: https://github.com/distractor/glista-api (if you pull it, make sure to go to 'publish' branch).

    Ok, so, I have this project, that I developed on my laptop with Windows 10 and VisualStudio. The project works perfectly on my localhost. Running the project opens the nice swagger page in my browser. Great.

    Things started to go really bad, when I decided to publish this to a server so people could have access to it. I tried the following things:

    • Heroku. I stopped quite fast as Heroku does not have support for .net 5.0 apps.
    • I wanted to create a server on my raspberry pi. WOW, that has a proper dark hole for time. It took me 3 weeks to figure out that it just won't work on that processor. -.-
    • I then tried DigitalOcean with a Ubuntu 20.04 droplet. Following this tutorial: https://driesdeboosere.dev/blog/how-to-deploy-aspnet-core-31-app-to-digital-ocean-linux-droplet/ and I failed miserably again. The issue was that the connection to IP/swagger/index.html was constantly refused. I kept getting the 404 error.

    Ok, Never give up they say. Don't worry, I tried other things

    • Tried to Dockerize that DigitalOcean droplet. Naturally, as I don't have experience with the docker I failed again. It kept returning:
      wget localhost:8080/swagger/index.html
      --2021-02-25 19:05:00--  http://localhost:8080/swagger/index.html
      Resolving localhost (localhost)... 127.0.0.1
      Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
      HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
      Retrying.
      So it has connected, but there was no response. what the hell.
    • Ok, I thought DigitalOcean is a problem. So I prepared my old laptop, installed Ubuntu 20.04 LTS and again tried to dockerize the thing. Same result. 
    • I then tried Azure: Created account, created resource group, went to configurations and set the .net 5.0.... Well now I am writing this post, so it again did not work. I keep getting the 404.

    So, I have come to a conclusion, that there is no way I am this stupid to fail this may times. True, this is my first time publishing things, but I can't be this stupid. There must be something wrong with my code and it for some strange reason works on my localhost, but not on a server. For that reason I also added my git repo so you can try it yourself.

    Now I have two requests:

    1. Can somebody please try build and publish my app? Just to see if I am publishing idiot.
    2. Can somebody please guide me to through the publishing process? Preferably on my linux 20.04 server. This is my machine, I can set/install there whatever I want.
      I mean it, seriously. Please help.

    Thursday, February 25, 2021 6:20 PM

All replies

  • User379720387 posted

    Sorry to hear all this, I am a few weeks behind you and I will have to go through this as well.

    First obvious suggestion is to try to a Windows Server first. That should be the happy path, right?

    Thursday, February 25, 2021 6:51 PM
  • User-2054057000 posted

    I recently went through Docker with ASP.NET Core area and I learned everything so want to tell you it takes time for me it took 2 months. I also deployed many apps with docker on azure including web api and database driven apps. I have published few docker videos on my youtube channel, you can see them they will be very helpful to you. These videos are just 14 days old and so will work perfectly if you try them.

    I want to tell you it take a little time to learn any programming topic. So don't worry you will learn them slowly and slowly.

    Friday, April 2, 2021 7:32 PM
  • User753101303 posted

    Hi,

    You are using Visual Studio? You could try perhaps https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-azure-webapp-using-vs?view=aspnetcore-5.0 even with no db and just an dummy API to see if tit works or whihc problem you have.

    Generally speaking it's liekly best to pick what you really want and if it fails to try to understand why and ask for help rather than just trying something else. For example in the worst case it could be something at the app level making the app tojust fail for some reason and so trying again and again something else would never solve your issue.

    Saturday, April 3, 2021 11:49 AM