31

I have a Function App in azure and when I hit the URL of the function app it says "Function host is not running." I am not sure where I have to check and what needs to be changed. I tried restart but still no luck.

spartans bmk
  • 371
  • 1
  • 5
  • 9
  • check this, it might help - https://social.msdn.microsoft.com/Forums/en-US/673b8cd7-8945-49e0-89e4-ee5bc06d21c3/function-host-is-not-running?forum=AzureFunctions – Mohit_Garg Mar 08 '18 at 06:18

7 Answers7

23

This usually means that there is some bad configuration in your function app which is causing the host to fail to start up. Things like having an invalid host.json or an invalid proxies.json file are a possible cause.

To diagnose, it's best to look at the function host logs. If you open your function app in the Azure portal and turn on log streaming, you should be able to get more information about what's going on.

If you're not able to find anything, please let us know the name of your function app either publicly or privately and we can help take a look at the logs for you.

Chris Gillum
  • 14,526
  • 5
  • 48
  • 61
  • Look, it is 2021 Summer and I still get this issue. Microsoft says: "Azure.Core: The SSL connection could not be established, see inner exception. System.Net.Http: The SSL connection could not be established, see inner exception. System.Net.Security: Authentication failed because the remote party has closed the transport stream." which remote party nobody knows. No issues with host.json. Another weird thing I find is that the command "funcationapp publish" just randomly without notice decides not to deploy some functions in the directory. I'm not sure what should I debug first. – SijuMathew Aug 02 '21 at 18:56
  • 1
    In my case it was a missing App Config setting that was referenced from a function trigger. – Rachel Jan 13 '22 at 17:45
  • Look at that, I'm back here in 2022 and Microsoft still amazes me. For some mysterious reason the host is down and I cannot just find anything in any log files. I'm surprised this piece of "software" from Microsoft is still in the market. – SijuMathew Jun 20 '22 at 13:57
  • In my case I noticed that after deployment for the first 5 minutes the function app does not respond. Working and debugging with this Microsoft product is a challenge. – SijuMathew Jun 21 '22 at 07:40
13

I was getting this after adding dependency injection support - I had an error in the startup class which stopped the host from starting.

Matt
  • 12,569
  • 4
  • 44
  • 42
  • 5
    Same for me. I had an error in my `Startup.cs` that didn't surface during local testing. It would have saved me some time if Azure provided some visibility. The errors were logged in Application Insights, but the only detail was "503". – Tom Faltesek Jul 02 '19 at 17:01
  • 3
    @t8tortotlover - yes I don’t quite remember the details but it wasn’t straightforward finding out that this was the issue for me either. – Matt Jul 02 '19 at 17:09
  • I had the same issue but [this comment](https://github.com/dotnet/extensions/issues/2931#issuecomment-653285478) helped fixing it. Just changed the `AzureFunctionsVersion` in csproj file from `v2` to `v3`. – alital Jul 08 '20 at 12:47
  • Yep - in my case, misalignment between local AppOptions and the Configuration actually in the Function App Settings – Mark Z. Apr 29 '21 at 17:00
3

Thanks for responding. I see that time trigger function in it is getting an error thats causing host to stop.I resolved the error now Function host is working fine.

spartans bmk
  • 371
  • 1
  • 5
  • 9
  • 2
    It is still the same with Microsoft Azure. Randomly fails and there could be a million reasons but nothing is logged anywhere. Randomly guessing what could have gone wrong and searching in the dark, for a needle in the haystack. And this is not the first time with Azure functions. Micro – SijuMathew Jun 20 '22 at 13:57
1

In Azure Function v2 you are required to set the runtime version in host.json

Erich Brunner
  • 612
  • 5
  • 19
0

Make sure to transfer configuration from trigger's like an Event Hub or a Service Bus to settings->configuration in your Azure Function App resource.

enter image description here

Blane
  • 643
  • 8
  • 13
0

I have had this problem all the time when I upgrade Microsoft.NET.Sdk.Functions 4.1.1 to Microsoft.NET.Sdk.Functions 4.1.2 If you are using 4.1.2 may sure you downgrade and your problem will be resolved likely.

Assil
  • 572
  • 6
  • 21
0

In my case it was due to bad configurations in service bus trigger, please find below configurations after correction

[FunctionName("MyServiceBusSubscriber")]
    public async Task MyServiceBusSubscriberListener([ServiceBusTrigger(topicName: "%TopicName%", subscriptionName: "%SubscriptionName%", Connection = "ServiceBusConnectionString")] string message)
    {            
        await Process(message);
    }

here is my local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "ServiceBusConnectionString": "",
    "TopicName": "",
    "SubscriptionName": ""
  }
}
Mayur Pawar
  • 107
  • 2
  • 16