Posted by Anuraj on Friday, June 1, 2018 Reading time :1 minute
AWS Elastic Beanstalk is an orchestration service offered from Amazon Web Services for deploying infrastructure which orchestrates various AWS services, including EC2, S3, Simple Notification Service (SNS), CloudWatch, auto scaling, and Elastic Load Balancers. Currently AWS Elastic Beanstalk only supports .NET Core 2.0.
First I created a ASP.NET MVC app, then I added a
aws-windows-deployment-manifest.json. Next I added a preinstall step. And in the preinstall step I added a PowerShell script which will download the .NET Core 2.1 runtime and install it on the server. Here is the
And here is the PowerShell script file.
Script is quite straight forward, first I am downloading the runtime file from internet, and installing it in AWS. Next I published the app using
dotnet publish command. And zipped the output directory, for deployment. Next I created a web application in AWS Elastic Beanstalk via AWS Management console.
And for application code I choose
Upload your code option.
Both Uploading and deployment will take sometime.
Once it completes the deployment, you will get a screen like this, where you will be able to see the status and health of the application
Everything went well, but due to some issues, I was getting a Process Failure error when I am trying to access the application. The error was something like this. -
Application '...' with physical root '...' failed to start process with commandline '"dotnet" .\hello-mvc-net21.dll', ErrorCode = '0x80004005 : 80008083.
I couldn’t find anything useful. I tried different options like removing wwwroot folder, redeploying, but nothing worked.
Later I found an alternative, deploying it as a self contained application. So I changed the csproj file like this.
Added the RuntimeIdentifier as win-x64. And then published it using
dotnet publish -o site -c Release command. The site folder compressed and saved it as
site.zip. Removed the
preInstall step from the
aws-windows-deployment-manifest.json file as well. And deployed again. And it started working.
Here is the ASP.NET Core app running in AWS.
Happy Programming :)