digitally_inspired
digitally_inspired

Reputation: 777

Running Azure function as Windows Service for Debug purposes

I have written an Azure (with http trigger method) function and it is hosted in Azure. However when I develop client applications which target the azure function I don't want to call the hosted Azure function, instead I am running the function from Visual studio and redirect the calls to this local copy.

Is there any way to keep this local copy running outside Visual studio environment in local machine? Perhaps like a windows service?

Any reference to an article would be great. Let me know if the question is not clear.

Upvotes: 2

Views: 823

Answers (2)

Iman
Iman

Reputation: 18906

for running it locally you can use the following command template. I think using it inside Topshelf will run it inside a service

C:\projectFolderPathWithi hostJsonFile> C:\Users\username\AppData\Local\AzureFunctionsTools\Releases\3.16.1\cli_x64\func host start --port 7072 --verbose --functions "func1" "func2"

Upvotes: 0

suziki
suziki

Reputation: 14088

As Kane says, if you dont want to based on Visual Studio, you can use azure function core tools.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=windows%2Ccsharp%2Ccmd

After install function core tools, you can use command func host start to run your function app.

Please note that you can only start one function app at a time locally, because the ports occupied by the azure function are all 7071 on local machine. The local is mainly used for testing.

Upvotes: 2

Related Questions