I would like to run a .NET Core MVC website from an AWS Amazon Linux AMI instance.
Here are the steps I have taken so far:
- Create a template ASP.NET Core Web Application (.NET Core) - C# - MVC Web Application project in Visual Studio 2015. Compile and run application in IIS Express. No changes made to any configuration (web.confg, project.json, etc).
- Upload entire web application solution to GitHub.
- Launch an Amazon Linux AMI (2016.03.2) instance. Security Group has "all traffic" access open for now for simplicity.
- Use PuTTY to SSH into Linux instance. Log in with ec2-user.
- Update the instance
sudo yum update -y
- Install libunwind
sudo yum install libunwind -y
- Install gettext
sudo yum install gettext -y
- Install .NET Core
curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet
- Link
sudo ln -s ~/dotnet/dotnet /usr/local/bin
- Install .NET Version Manager (DNVM)
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
- Run command
source /home/ec2-user/.dnx/dnvm/dnvm.sh
- Install .NET Execution Environment (DNX)
dnvm upgrade -r coreclr
- Install libuv to be used by Kestrel
sudo yum install automake libtool wget -y wget http://dist.libuv.org/dist/v1.8.0/libuv-v1.8.0.tar.gz tar -zxf libuv-v1.8.0.tar.gz cd libuv-v1.8.0 sudo sh autogen.sh sudo ./configure sudo make sudo make check sudo make install sudo ln -s /usr/lib64/libdl.so.2 /usr/lib64/libdl sudo ln -s /usr/local/lib/libuv.so.1.0.0 /usr/lib64/libuv.so
- Install Git
sudo yum install git -y
- Create directory in '/home/ec2-user' directory for application. Move to that directory.
mkdir director-name cd directory-name
- Clone web app with Git
git config user.name "myUserName" git config user.email "myEmail" git clone https://github.com/username/repositoryname.git
- Move to 'project' directory
cd solution-name/src/web-project-name
. - Restore packages
dotnet restore
- Build application
dotnet build
- Run application
dotnet run
At this point I see the following in the terminal:
Now listening on: http ://localhost:5000
I attempt to hit the AWS DNS/IP with port 5000 tagged at the end (http ://aws-ip-or-dns:5000), but get no response.
I know that Docker and Mono are tools that I can use, but I would rather get this approach to work.
The scripts I used to install .NET Core, DNVM, and DNX are some combination of the CentOS and Ubuntu directions from these links:
- https://docs.asp.net/en/latest/getting-started.html
- https://www.microsoft.com/net/core#centos
- https://docs.asp.net/en/1.0.0-rc1/getting-started/installing-on-linux.html
Disclaimer I am not that experienced with Linux. It is fair to say I don't understand some of the commands that I'm running. But, I'm here to learn!
Question: What do I need to do to get a template .NET Core web application running an an AWS Amazon Linux environment?
(My guess is I have something missing with setting up the HTTP server)
I need more reputation to post more than two links, so if someone wants to EDIT, I'd appreciate it.