I am learning Asp.net Core Web Api. I need to access the api from a flutter application but am not ready to host the api on Azure. What are my options if I want to host the api locally on my computer so I can access it from another application like my Flutter app client, and is there any tutorials I can follow to learn how to implement the solution.
-
You simply run the application (e.g. in development mode) and host the app that way on some port which you will need to configure the consuming application with.poke– poke2020-08-03 21:19:31 +00:00Commented Aug 3, 2020 at 21:19
-
In visual studio, just run it. press the green "play" button, or just F5 key. Visual Studio should start up a browser automatically and navigate right to the page where your site exists.Andy– Andy2020-08-03 22:35:12 +00:00Commented Aug 3, 2020 at 22:35
-
1Just make sure that you have installed IIS on your localhost and you can read this tutorial windowswebhostingreview.com/…. It might be helpful for youMark Spencer– Mark Spencer2020-08-05 04:20:41 +00:00Commented Aug 5, 2020 at 4:20
2 Answers
There are several ways to go about this, here are some options:
FROM VISUAL STUDIO: You can simply run the ASP.NET Core Web API from Visual Studio in Development Mode by Pressing F5
FROM COMMAND PROMPT: Run the API Project from the command line by opening a command prompt window in the root project folder of the project and use the dotnet run command. See here for more info about the command: dotner run command
HOSTING IN IIS: I am assuming you are running a windows OS. You can turn on IIS and its features. Simply follow the instructions on this page: Host ASP.NET Core in IIS on how to deploy ASP.NET Core to IIS. The advantage of this is that you have the application always running while you work on your flutter application locally.
I hope this helps you resolve your situation.
1 Comment
What are my options if I want to host the api locally on my computer so I can access it from another application like my Flutter app client, and is there any tutorials I can follow to learn how to implement the solution.
If your application is developing now, there is no need to host the application and let the Flutter app client to access. We could build some json file as the right format like web api response to develop the client app.
If your client application and web api has now developed successfully, you want to host the web api to let fluent app or other application to access from internet. You should have a public IP address and host the application on IIS or else. Public IP address you should ask for the IP provider company. Without a public address, the client side app couldn't access your application from internet.
If your web api and the client app are in the same intranet, you could let the client app directly access the web api after the web api hosted on IIS by using hosting server's IP address.
About how to host the asp.net core application on IIS, you could refer to this article.