I'm trying to remove the "api" prefix in my URL.
This is my host.json.
{
"version": "2.0",
"extensions": {
"http": {
"routePrefix": ""
}
}
}
NOTE: if I change "routePrefix" : "foo", it works. It seems that the string.empty is causing the problem.
This is my startup.cs code:
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
var serviceProvider = builder.Services.BuildServiceProvider();
var existingConfig = serviceProvider.GetService<IConfiguration>();
var config = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddConfiguration(existingConfig)
.Build();
builder.Services.AddSingleton<IConfiguration>(configRoot);
services.BuildServiceProvider(true);
}
}
Note that I am already adding the existing configuration to the builder, as per documentation in here:
https://github.com/Azure/azure-functions-host/issues/4363
https://github.com/Azure/azure-functions-durable-extension/issues/894
And this issue, someone else also reported the same problem as me. But the ticket is closed...
https://github.com/Azure/azure-functions-host/issues/5466
What else am I missing or doing wrong?
aside: if I comment out this line, then the URL with api also works. builder.Services.AddSingleton(configRoot);
