You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run the project using dotnet watch -p src/WebApi run
I got this error.
Unhandled exception. System.ArgumentNullException: String reference not set to an instance of a String. (Parameter 's')
at System.Text.Encoding.GetBytes(String s)
at Infrastructure.Files.AuthenticationExtension.AddTokenAuthentication(IServiceCollection services, IConfiguration config) in /src/Infrastructure/Files/AuthenticationExtension.cs:line 14
at TechneTravel.Infrastructure.DependencyInjection.AddInfrastructure(IServiceCollection services, IConfiguration configuration) in /src/Infrastructure/DependencyInjection.cs:line 75
at Program.<Main>$(String[] args) in /src/WebApi/Program.cs:line 21
watch : Exited with error code 134
watch : Waiting for a file to change before restarting dotnet
I guess The issue is because of not getting the values of environment values.
AuthenticationExtension.cs
public static IServiceCollection AddTokenAuthentication(this IServiceCollection services, IConfiguration config)
{
var secret = config.GetSection("Tokens").GetSection("Key").Value;
var key = Encoding.ASCII.GetBytes(secret);
// removed rest
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to run the project using
dotnet watch -p src/WebApi run
I got this error.
I guess The issue is because of not getting the values of environment values.
AuthenticationExtension.cs
This is my appsettings.Development.json
Beta Was this translation helpful? Give feedback.
All reactions