question

ChamPer-5472 avatar image
0 Votes"
ChamPer-5472 asked ChamPer-5472 edited

Publishing an asp.net core web application on linux ec2 instance

I have followed the steps mentioned in the following article published by Microsoft.

https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-7.0

I am bit new to asp.net core and publishing web apps in Linux environments.

Even though I followed the above article, once I finished everything and when I started the web app using "sudo systemctl start kestrel-helloapp.service" and check the status of the app status using the "sudo systemctl status kestrel-helloapp.service" command I receive error code 203.

I have published my through AWS CodePipeline, to /var/www/html folder. And I can see all the files are published successfully to that folder.

I'm not sure what I am doing wrong in here because when I navigate to the load balancers dns name, I only see the Apache test page, not the web application home page.

dotnet-aspnet-core-generaldotnet-aspnet-core-razor
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ChamPer-5472,

If you can run the application successful in local. The 203 error doesn't relate the Asp.net core code. Perhaps there have some required configuration when deploy the application.

Since you are using AWS Linux EC2, you'd better to search how to publish the asp.net core application on AWS Linux EC2, and you can contact AWS Linux EC2 forum to ask for help.

Best regards,
Dillion

0 Votes 0 ·

@ZhiLv-MSFT : Thanks for your response. I have figured out the issue in my case. The issue was I have given an incorrect path for "dotnet" in ExecStart command. I have tested the steps in the following URL, on an AWS Linux EC2 instance, and I can confirm that my test asp.net core application is working fine.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?view=aspnetcore-7.0

I have setup through a pipeline. To get the application code, build it and publish it to the EC2 instances. I now have to figure it out on how to give those commands, so that all the steps are automated.

I will post my answer here, so that others could benefit from it as well.

0 Votes 0 ·

@ZhiLv-MSFT : To make it work, I had to remove the "ServerName" and "ServerAlias" attributes in the .conf file (helloapp.conf). Since I did this as a test I do not have a proper URL to test. In production, those two attributes are used to hold the value of the web application URL that I am publishing to the EC2 instances. Am I right? Please let me know.

0 Votes 0 ·

0 Answers