If ASPNETCORE_ENVIRONMENT is unset it defaults to Production. Testing out the API with something like curl http://localhost:5000/api/hello will then output nothing without raising an error from curl or the server due to the call to UseHttpsRedirection(). The situation becomes evident if one thinks to pass -v or -L to curl, but it took me longer to figure out than I'd care to admit. A mention of the need to explicitly set ASPNETCORE_ENVIRONMENT=Development in README.md and/or the comments in the template itself could solve the issue. This is probably fairly obvious to those with more knowledge of ASP.NET than myself, but I thought I'd bring it up since this is now the second time I've managed to trip over it while setting up a new project.
If
ASPNETCORE_ENVIRONMENT
is unset it defaults toProduction
. Testing out the API with something likecurl http://localhost:5000/api/hello
will then output nothing without raising an error fromcurl
or the server due to the call toUseHttpsRedirection()
. The situation becomes evident if one thinks to pass-v
or-L
tocurl
, but it took me longer to figure out than I'd care to admit. A mention of the need to explicitly setASPNETCORE_ENVIRONMENT=Development
inREADME.md
and/or the comments in the template itself could solve the issue. This is probably fairly obvious to those with more knowledge of ASP.NET than myself, but I thought I'd bring it up since this is now the second time I've managed to trip over it while setting up a new project.