Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Functions 2.0: How to start a project from command prompt and allow connection from other machines?

I am developing an Azure Functions 2 Project, when using Visual Studio 2017 and Run, it Works like this: dotnet Azure Functions

1) What is the command line and proper parameters to launch the Azure Function Project DLL ?
How can I run this same via command prompt (outside Visual Studio)?

2) How to accept connections from other machines, not only localhost?
I want that it accepts like ASP.Net Core (.UseUrls("http://+:7071")):

Now listening on: http://[::]:7071

but it is only listening on

http://localhost:7071

I am Azure fan, but I am asking this because I want to put a development version on a local server (on premisses), later when application grows I plan to publish to Azure; but now I don't want to install SQL Server on this server to run Azure Functions portal (Azure Functions Runtime)...

I don't want to install the Azure Functions portal. I just want to launch the Project, the same way Visual Studio 2017 does and accept connections from other computers, using the IP address or computer name.

like image 533
Tony Avatar asked Jan 19 '18 18:01

Tony


1 Answers

I tested now and with the new version it works as I expected! Now I can easily run the Azure Functions on the Desktop and call the API on another device on my local network, also from my Mobile phone.

I updated to Visual Studio 2019 and the tools got updated to:

Azure Functions Core Tools (2.6.1080 Commit hash: 509d59b7eb6fbfb89f70ce96ad22e00f8f7bafdd)
Function Runtime Version: 2.0.12427.0

Now on the console it appears:

Now listening on: http://0.0.0.0:7071

Screenshot

To run the function from command line, outside Visual Studio, I did:

Install/update the tools:

npm install azure-functions-core-tools -g

Start the Azure Functions Host:

func host start

(I used npm 5.6.0, wich is installed with nodejs)

like image 54
Tony Avatar answered Oct 12 '22 14:10

Tony