Deploying the ASP.NET Core API to Azure Web Apps - A TimCo Retail Manager Video

Поділитися
Вставка
  • Опубліковано 1 бер 2020
  • In this video, we are going to be deploying our API to Azure Web Apps. Once we get that up and running, a future video will cover how to automate this process using CI/CD as well as how to migrate our databases to Azure SQL Databases.
    ** TimCo source code now at: www.iamtimcorey.com/courses/b...
    Full Courses: www.iamtimcorey.com
    Mailing List: signup.iamtimcorey.com/
    One-off tutorials are awesome but they aren't the only thing you should be doing to learn C#. Another vital part of learning is learning how to put it all together. This interactive course is all about putting the pieces together. You can watch each video on its own or you can watch them in order and see a bigger picture. The choice is yours.
    This course focuses on real-world development. As such, we are simulating that we work for TimCo Enterprise Solutions on a brand new product, the TimCo Retail Manager. Just like in the real world, we are starting out with one set of requirements but know that over time they will change.

КОМЕНТАРІ • 116

  • @KDOERAK
    @KDOERAK 3 роки тому +1

    a great intro to this subject: easy to follow, practical, not too long - thx!

  • @doyin_dimeji
    @doyin_dimeji 4 роки тому

    I appreciate this a lot! Earned a new subscriber.

  • @TheJessejunior
    @TheJessejunior 3 роки тому

    this is so incredible usefull!!! thanks once again tim!

  • @thmater-x9786
    @thmater-x9786 4 роки тому

    Thank you Tim for the Video

  • @user-ju1ek6ve9d
    @user-ju1ek6ve9d 4 роки тому

    Thanks a lot. It was very helpful

  • @aymannasr1323
    @aymannasr1323 3 роки тому +1

    You are Awessssssssssssssomeeeeeeeeeee , I love your content Thanks Tim : )

  • @AgentOfLogos
    @AgentOfLogos 4 роки тому +1

    Good video. Light can go around the entire world 7 times in 1 second. I'm pretty sure the lag is more of a hardware interaction, as well as software.

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +2

      Thanks! Just a quick note about latency. While light can go around the globe that fast, that isn't really what is happening. Yes, we use fiber optic cable but it has to go through relays, etc. For example, from my location to Australia is about 250ms. That's why we still pick data centers close to our central customer bases.

  • @ijeanpierrebp
    @ijeanpierrebp Рік тому

    great video, thanks a lot!

  • @rubiconteam2650
    @rubiconteam2650 3 роки тому

    Hi Tim, is it OK to leave the API in azure running, or should I stop it?

  • @sneakybeard
    @sneakybeard 3 роки тому +1

    Hey Tim, loving the course and just bought an all access pass a few days ago. I just gotta say, registering and signing into azure services has been a nightmare for me. I've spent so much time trying to access old accounts to no avail, and registering new accounts forces me to fill in more annoying forms. Their security is so rough compared to any other service I've ever used in my life, it's ridiculous and driving me insane. I hope the actual tools they provide are worth the effort haha

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому

      I think you will find them of value.

  • @scottaragorn7633
    @scottaragorn7633 2 роки тому

    hi, i got following error:
    Error Protos\WebService.asmx: No such file or directory

  • @Popc1007
    @Popc1007 2 роки тому

    great video thanks

  • @emreaka3965
    @emreaka3965 2 роки тому

    Thank you.

  • @TheAhsanranjha
    @TheAhsanranjha 3 роки тому

    how we can secure these web api and call web api from SharePoint and other web apps?

  • @queenstownswords
    @queenstownswords 4 роки тому

    As usual, good stuff! The price for SQL is a bit of a bummer but, as you noted, you can turn it off. (please include how to turn it off in the next video...)

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      Just delete the SQL Server and you are good to go. You can even script the creation/removal using Powershell so that you can do this automatically or with just a click of a button.

  • @root317
    @root317 3 роки тому

    It shows no targets when i try to publish :(

  • @arnoldjeandre9293
    @arnoldjeandre9293 4 роки тому +1

    Hi Tim
    Your videos are amazing, do you think you could make one on how to use NodeJS in ASP MVC5?

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +1

      I won't have a NodeJS video for a while but you really shouldn't need to mix Node and ASP since they are both back-end/server-side languages.

  • @Ashikzaman43
    @Ashikzaman43 3 роки тому

    You are the best

  • @rayhou95
    @rayhou95 4 роки тому

    Hi Tim, with app services no need to purchase and install ssl certificate ? Instead of IIS ?

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +1

      You do not need a SSL certificate for testing but you will need to have one for your custom domain.

  • @bitsbytesandlife
    @bitsbytesandlife 4 роки тому

    Hey Tim do have any thoughts on Microsoft dropping a lot of there certifications in lieu of role based certifications?

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +6

      I like it. It is more focused on what you are skilled in rather than a broad area that might not all apply to you. Certifications are hard no matter what. People study for the test and don't know how to do the job they are certified for and people who do the job every day struggle to get the certification even though they can do the job. They are definitely no substitute for experience.

    • @user-sz3nn2lb6u
      @user-sz3nn2lb6u 2 роки тому

      @@IAmTimCorey totally agreed

  • @DerekWelton
    @DerekWelton 4 роки тому

    Offtopic: I know this course and your weekly challenge are being developed on a weekly bases, but out of curiosity, when will your next full course come out? Last one I believe came out Jan 22

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +1

      Based upon my schedule, it looks like one should come out this month.

  • @Ram-yk7yl
    @Ram-yk7yl 3 роки тому

    Tim, after publishing the api initially to Azure, i’f i have to make some changes to the code and has to redeploy again, if i publish again its going overwrite on the server with the new version ?

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому +1

      Yep, you will put the new web application over top of the old version. That won't affect the data since the data lives in the database.

  • @andywalter7426
    @andywalter7426 4 роки тому +2

    I have a question. How can somebody get the practice of sql server deployment if they can't afford the monthly fees for sql server hosting. I would suggest using sqlite so for those with no money can still do more with the course.

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      Well, the problem with that is that SQLite is much different than SQL. The good news is that you only get charged for what you actually use so you can practice the deployment and get good at it and then turn it off. So even if you are off of the free year trial (which provides SQL), deploying and testing to the cheap Azure SQL database will cost about $0.16 per day. So it would take almost a week to even spend a dollar. Now, I do realize not everyone has the financial resources to spend money on education. That's why it is not a requirement to continue in this series. For those who can, or for those who are on the free 12-month trial, I still want to offer value.

    • @rickytheil3744
      @rickytheil3744 4 роки тому

      I was told by a Microsoft employee to just use a new email address to create a new account to get the 12 month free trial.

  • @bilalshafqat1634
    @bilalshafqat1634 3 роки тому

    Hey Tim thumbs up for this great tutorial. Have you also posted tutorial with CI/CD pipeline for API deployment? Thanks

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому

      Have you checked this one out? ua-cam.com/video/056ByxTxFVE/v-deo.html

    • @bilalshafqat1634
      @bilalshafqat1634 3 роки тому

      @@IAmTimCorey Thanks man. Appreciated.

  • @Baraka-yl2dp
    @Baraka-yl2dp 3 роки тому +1

    Hi Tim, given your deployment of the API, is it possible to use a localdb file in Azure instead of creating an Azure SQL database? If yes, can you please explain how it can be done? Great course by the way. Thanks for the great content.

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому

      Nope. LocalDB is for development. When you deploy to a production environment, you need to use a production database.

    • @Baraka-yl2dp
      @Baraka-yl2dp 3 роки тому

      @@IAmTimCorey how about using sqlite or Sql Compact Edition? I don't need a full featured database. A simple database file will do.

  • @honfey
    @honfey 3 роки тому

    Hi, Tim, if we directly publish the app to live server, sometimes it may take 1 to 2 minutes to complete the publish, will there be any issue if there are users using the service on the live server? I guess it will affect the users right? Is there any solution that we can publish the code to a folder in the live server, after that only we point the live server to that folder? If any issue happens, we can switch or point back the live server to the previous folder, is that possible?

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому

      It depends on how you are publishing but yes, actually publishing (which is only a small part of the process - don't confuse the building with a user-disrupting step) will cause some disruption. That is why in Azure, you can publish to a pre-production slot and then do a slot swap. That allows you to get your web app up and running and tested and then just point everyone to the new site without any downtime.

  • @piyushbaral7444
    @piyushbaral7444 4 роки тому

    Hi Tim ,I followed the video but end up with HTTP ERROR 404,No webpage was found for the web address: is there anything missing from my side?

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      My guess is that your URL is different than mine. A 404 means it didn't find the page at that location.

  • @rickytheil3744
    @rickytheil3744 4 роки тому

    Hello, Tim. Hey, this is a great video. I followed your instructions closely in order to deploy an API I've written, and all I get is that default startup page when deployed. I noticed an error within logs stating that .Net Core 3.1 SDK isn't installed, so I contacted Microsoft about it and they said it needs to be installed manually on Linux. I don't understand why, in my case, I'd need the .Net Core SDK to run my API.

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      Yep, you need .NET Core installed on your target machine. However, you can also do a self-contained deployment (take .NET Core with your API) in order to avoid most of that.

    • @rickytheil3744
      @rickytheil3744 4 роки тому

      @@IAmTimCorey I will try the self-contained deployment. Thanks. Why is it that in this tutorial you did not have to do that?

  • @LarryB15
    @LarryB15 3 роки тому

    Hi Tim
    Just following this video and a few things seem to have changed on Azure since you did the video.
    Most are minor, but when publishing my API to azure I had to create Azure API Management which is a step you didn't do.

  • @demar0228
    @demar0228 2 роки тому

    Hi Tim. Great video as always. Question though. Do I need to setup a API management service when deploying and consuming an API. I have a free azure account and I had setup the API management services along with deploying an API however I see where I’m being charged $48 monthly for the management services. So I wanted to know if it’s a requirement for an API to run in Azure and if not how do I delete it?

    • @IAmTimCorey
      @IAmTimCorey  2 роки тому

      No, it is not a requirement to set up API management. As for deleting it, you would need to go to the service and remove it.

  • @cgracs
    @cgracs 3 роки тому

    Hi Tim awesome video! Does this video work for single page applications? I have a react and .net core application that I would like to deploy.

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому

      Yep, that would work.

    • @cgracs
      @cgracs 3 роки тому

      @@IAmTimCorey Thanks for the reply, I seem to be getting an error System.InvalidOperationException: Key type not specified. I believe it could be due to identity server 4, know any way to fix this?

  • @katsmike853
    @katsmike853 4 роки тому

    Hey Tim, I just deployed my API but there is a problem, The website was not showing my API home page but the default one. I went to the logs at the portal, and apparently it couldn't find the .Library. "Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'MyAppApi.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified"..
    EDIT 1: After some further lookup, It seems like something is getting messed up when I try to publish and the API is getting built. If I build locally, it works fine. If I publish, as I said it does not work on Azure, but what I can't understand is that it doesnt even run locally. I have to rebuild of it to work, and so on and so forth.. I am lost..
    EDIT 2: Just to see what happens I embedded everything from the api.library to the api so I didnt have to deal with dlls, and it worked.. actually it worked great so yeah.. thats really weird.. What i think happens is that when I hit Publish, something goes wrong with the build and the Library dll does not get included..
    Do you think That I did something wrong ? Anyone else with the same issue?

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      It sounds like you aren't publishing the dll along with the API. Not sure why that would happen though.

  • @0387778o
    @0387778o 2 роки тому

    Hey tim, I published my api to azure with a sql database. one of the functions of the api is to save images to a folder called Images in the wwwroot folder, and save the image name to the database. when sending the image to api via Post method, i get a GDI+ exception from the Image.Save() method. After some research i think it is because azure does not give the api permission to save the image in the folder, but i do not know how to give my api permissions to do so. Can you please help me?

    • @IAmTimCorey
      @IAmTimCorey  2 роки тому

      You would want to change how you save the images to save to Azure Storage instead when working on Azure. Otherwise, your website cannot scale up (which is one of the big benefits of Azure, which is why it doesn't allow you to save files locally).

    • @0387778o
      @0387778o 2 роки тому

      @@IAmTimCorey Thanks

  • @defiledgamingnl2284
    @defiledgamingnl2284 2 роки тому

    it sucks i dont have access to a credit card... is there another way to do this so i can continue the course?

    • @IAmTimCorey
      @IAmTimCorey  2 роки тому

      You can skip the deployment sections. Doing so won't negatively affect the rest of the content.

  • @arturmazela9795
    @arturmazela9795 3 роки тому

    Hey, I'm new to Azure and I can't find any info on the web. I'm creating a multiplayer monopoly game with .NET Core WebApi with SignalR to manage WebSockets. Currently, my version works when I open it several times on localhost and I don't know if It will works when I open that several times using the URL given by Azure? My first thought is yes because I can open your application via URL in this video(it's unique) so it should work but I'm not sure so that's why asking. Thanks for any response.

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому

      Yep, that should work.

    • @arturmazela9795
      @arturmazela9795 3 роки тому

      @@IAmTimCorey Thanks for the response, I will soon be done with my app so if anyone will have some issue with similar project architecture, be free to comment under I will help if I can :)

  • @farukalkaya
    @farukalkaya 2 роки тому

    I'm fighting with web app (linux) on azure. Because file write permission denied. System.IO.IOException: Readonly file system. Are there anyone facing with this error before?

    • @IAmTimCorey
      @IAmTimCorey  2 роки тому +1

      Is your web server trying to write to files on disk? If so, you might need to look at writing to Azure storage instead.

    • @farukalkaya
      @farukalkaya 2 роки тому

      @@IAmTimCorey Yep, I afraid it's time to turn back to azure win web app ;)

  • @sureshkaranam4280
    @sureshkaranam4280 4 роки тому

    Hi TimCorey your videos are good could you please do more videos on azure devops and as well as how to integrate with web api to azure devops ci/cd pipeline.

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +1

      That will be a part of this process. I like to get the API deployed manually before turning it into a CI/CD process. That way I know it works.

    • @sureshkaranam4280
      @sureshkaranam4280 4 роки тому

      @@IAmTimCorey Thanks for the reply . Do you have any links regarding Web API CI/CD process. Could you please help me on this.
      Thanks in Advance

  • @rohanrvs
    @rohanrvs Рік тому

    Hey Tim, Can we publish the API application without using Visual Studio publish to Azure. Say like publishing the code to some local folder and then coping the files to the Azure Web App? If yes then can you create a video on how we can do it. If you have already created such a video then kindly share the link to that. Thanks

    • @IAmTimCorey
      @IAmTimCorey  Рік тому

      You can do that. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/

  • @thedrjonez
    @thedrjonez 4 роки тому +1

    Question. I followed the video, twice and am still not seeing the login screen from the API. Is anyone else having this same issue it have they resolved it? Thanks in advance!

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +1

      We converted the app over to .NET Core. Did you follow that before? If not, you might not have that login page.

    • @thedrjonez
      @thedrjonez 4 роки тому

      The TRMAPI property in indeed .NET Core 3.1, and runs just fine on the computer. Just ran through for the third time too with the same results. Thinking it might be Canada Central? I look at my resource group and it does have 2 deployments succeeded

    • @KL-cv2lt
      @KL-cv2lt 4 роки тому +4

      I thought I was alone :) I am having exactly the same symptoms. Have already recreated the Azure resources several times. I followed all the steps and lessons too. UPDATE: Here is what worked for me. I went to Manage Nuget Packages of TRMApi and found 5 EntityFramework nugets updates pending. I ran all 5 updates. I also ran a Caliburn.Micro 4.0.114-alpha update on TRMDesktopUI, but I don't believe it could affect the API. After that, I cleaned the solution, rebuilt and published again. The initial screen was the standard one, but 5 seconds later I refreshed the page and voila! - I now have the api login screen.

    • @thedrjonez
      @thedrjonez 4 роки тому +1

      @@KL-cv2lt I am about to try to use exactly what Tim is using.as the settings I have don't appear to work and being I have like zero experience with Azure... I'll post back in here later if I am able to figure it out.
      All a part of learning right? Tear it apart and put it back together a ton of different ways until it all starts to work and then sit there and scratch your head trying to figure out what you changed to get it to work.

    • @KL-cv2lt
      @KL-cv2lt 4 роки тому +1

      @@thedrjonez I have done what you are about to do 7 times and it didn't work for me :) Updating the NuGet packages did work.

  • @ronaldmackee3401
    @ronaldmackee3401 4 роки тому

    Is it 10 free websites because you have a subscription, or it doesn't matter? Also, if I were to use a SQLite database, would that still be free?

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      When you sign up for a free Azure account, you get the free 10 websites (for life) along with a number of other features for free for life or for the first year. You also get credits for the first 30 days. As for SQLite, I haven't used it in Azure but I believe you could put it in storage for fairly cheap.

    • @andywalter7426
      @andywalter7426 4 роки тому +1

      I have used sql lite before and its for sure free. If you deploy as part of your website, then its completely free. You don't even have to use azure storage. Not sure how to even deploy and use azure storage for sqlite.

    • @pilotboba
      @pilotboba 4 роки тому

      @@andywalter7426 Keep in mind, SQLite stores it's data in a file somewhere. The storage on your Azure website is transient. So, if you bring the server down, boom, your data is gone.
      The second issue is scaling. If you run two instances our your api/app, each server will have it's own database. So, you have to make sure you have some type of shared file system.
      But, yea, it's fine for playing and testing and the price is right.
      There's other option for a db without paying. Create a free VM and install SQL Server Express on it for example. So, the VM can host both the db and the api and the website.

  • @roddyzr3364
    @roddyzr3364 3 роки тому

    14:16 In database option say
    Dont database detected 😣

    • @IAmTimCorey
      @IAmTimCorey  3 роки тому +1

      First, check your appsettings.json file to be sure you have connection strings in there. Then, if you do, don't worry about it. You are going to be using Azure to replace the connection strings anyway.

    • @roddyzr3364
      @roddyzr3364 3 роки тому +1

      @@IAmTimCorey yes that was the problem
      Thanks.... 🇪🇨

  • @katsmike853
    @katsmike853 4 роки тому

    What if you tried to migrate the whole API to azure functions? That would be something very interesting to see in a real world scenario!

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +1

      Typically an Azure Function does not do the same job as an API.

    • @katsmike853
      @katsmike853 4 роки тому

      @@IAmTimCorey Wouldn't HTTP triggered Azure functions work as API endpoints?

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +1

      No, not really. Each one would be one endpoint. It would be really messy and it isn't what they were designed to do and the end result would be to have a messy version of an API (vs the clean API project type). The HTTP trigger Azure Functions are designed for single-entry triggers. For instance, you can use them to capture web hooks like we did in my video on Azure Functions. There an API would be overkill but an Azure Function is just right.

    • @katsmike853
      @katsmike853 4 роки тому

      @@IAmTimCorey Thank you very much for the replies. You are really helping me understand this better! Also I understand that you may not want to turn the comment section into a conversation but I have one more thing to say about the Azure functions based API and its okay if you don't want to answer. Wouldn't an Azure Functions based API be a very cheep option for lets say a Startup that does not have many end users, to host an API on the internet, that can be used as a platform for their Mobile app, desktop app, or website etc.. It would be basically free even with a few users. on the other hand the "clean" API lets say an asp.net WebAPI would probably be much more expensive considering that the functions would be very close to free (1.000.000 free function calls). Thank you in advance and sorry for maybe spamming you.

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому +4

      I don't always answer replies because I quickly start to not see them in the comments section. With over 200 videos that gain comments continually, it can be tough to keep up. Using Azure Functions as a substitute for an API would be unmanageable. An API most likely needs to be secured. Applying security manually on each Azure Function would be difficult, if not impossible, to manage. Azure Web Apps are very inexpensive to host and they would make the management of your API much easier than multiple Azure Functions. Don't forget that part of the cost of hosting is how much time you spend maintaining something. Your time isn't free, even if you are a startup. If it takes one person four hours a month to maintain your Azure Functions setup, you are losing money like crazy compared to an Azure Web App. A Standard tier Azure Web App (which probably has all of the features you would want and more for starting out) costs $43/month. That means that your developer who spends the 4 hours a month maintaining your Azure Functions would have to be worth less than $10/hour. If you used the lowest-priced hosting ($10/month), your developer would have to be worth less than $2.50/hour. Time really does mean money. I understand that startups don't usually have much money so sometimes time is what needs to be spent but Azure gives you 10 free web apps for life. Start there.

  • @santiagopiaggio2099
    @santiagopiaggio2099 4 роки тому

    Have you ever worked with Polly? " Polly is a .NET resilience and transient-fault-handling library ... "

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      I have not but it does seem like a good candidate to cover in the future.

  • @brtk7
    @brtk7 4 роки тому

    Stop promoting this Microsoft shit

    • @IAmTimCorey
      @IAmTimCorey  4 роки тому

      This channel is all about learning C#. C# comes from Microsoft. I am teaching things that a person working with C# will most likely come across. Sometimes that involves stuff from Microsoft. Mostly I try to teach free things (Visual Studio, VSCode, Docker, git, Azure DevOps, and more) but sometimes you need to do something that costs you money (like deploy your code into production). In that case, I try to keep the costs as low as possible. In this case, there is no cost to deploy to Azure Web Apps if it is one of your first ten apps. So why shouldn't I show that? Don't just complain because it is Microsoft. They give developers a TON of free content to help them get to a point where they can make money with C#.