A quick and easy way to get your code up and running on Azure App Service is to upload your code using FTP. FTP can be as simple as a drag and drop process from your desktop, or as complicated as having your CI/CD pipeline run an FTP client for you. While it’s not an ideal scenario for large scale deployments due to the individual uploading of files one at a time, it’s a good starting point if you are just looking to have a play with Azure without too much fuss.
Setting Up FTP In Azure Portal
After creating your App Service, FTP may not be immediately available if you have never used it to deploy applications before. Deployment credentials, while they are viewable under a particular app service plan, are actually for the entire Azure account. So if you have *ever* used FTP or GIT to deploy apps before, the credentials will already be set and you should use those same ones. Resetting the credentials, even if you only do it within one app service, will reset them account wide.
Thankfully this is easy to check. Head over to your app service overview screen, if on this page you have an FTP deployment username showing, then you or someone else has already set up credentials.
If you don’t see anything here, then you will need to scroll down to the Deployment section, you should see an option for “Deployment credentials”.
Enter in a username/password combination you would like to use for FTP. Again, I cannot stress enough that this will be used on all FTP deployments for the entire account, not just this one app service plan.
Publishing Your ASP.net Core Web Project
Because App Service in Azure has a runtime installed, publishing your app is a one line job.
Open a command prompt in your project directory and run the following :
dotnet publish --configuration Release
Heading to “bin\Release” you should see your published project for your .net core runtime (netcore1.0 or netcore1.1).
Uploading Your ASP.net Site
Back on your App Service overview, you should have a FTP hostname to connect to using your favourite client (I use Filezilla). After connecting, make your way to /site/wwwroot.
Upload your entire published app to the wwwroot.
Docker Settings For Linux App Services
Linux App Service plans are currently 50% of the Windows price right now, and given it’s a PaaS service, it really doesn’t make a huge difference what the underlying OS is. If you are using Linux, you will need one extra step to get going.
On the app service menu, under the Settings category, there should be an option for “Docker Container”. Here you can select your runtime stack but more importantly, you set the “entry” DLL for dotnet. Set the startup file to “dotnet /home/site/wwwroot/{yourdllhere}”.
Head back to the app service dashboard and restart the service. Wait 5 minutes and hit your URL and you should be up and running!