I am trying to build a Web API using ASP.NET Core 6. just a simple CRUD example. I can access and interact with the API through the link
https://localhost:7270/swagger/index.html
Now I want to access it from another VM. pls show me how can do that? tks so much
CodePudding user response:
If you are using windows server, you could host the application inside the IIS.
Short step: 1.You should install the host bundle for the asp.net core 2.Create the IIS web application and add some binding information 3.You should publish the application into the IIS website or folder 4.Start the application and on other VM you could use IP address: Port to access the IIS .net core application.
For how host .net core 6 application inside IIS, you could refer to this article.
CodePudding user response:
If you are using windows/windows server and kestrel:
1 - Change application URL from https://localhost:7270
to https://0.0.0.0:7270
.
2 - Go to Control Panel / Network and Sharing Center / Advanced sharing settings
and switch to Turn On
in all sections.
3 - Go to Control Panel / System
check button allow remote.
and go to second VM and call first vm with ip and application port