Author : MD TAREQ HASSAN | Updated : 2021/03/15
Unable to connect to iis express
Possible cause: launchSettings.json
- File was corrupt or incorrect
- File was changed and that caused failure
Solution:
- Close Visual Studio
- Go to project folder > properties > Delete
launchSettings.json
- Open Visual studio > run the project
- Coutesy: Comment by “Quinton Smith” in StackOverflow answer: https://stackoverflow.com/a/36801686/4802664
No database provider has been configured for this DbContext
- Check:
services.AddDbContext<ApplicationDbContext>(options => ... )
inStartup.cs
- Check:
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options){}
in the DbContext class - Check that there is no parameterless public constructor in DbContext class (delete parameterless public constructor)
Other probable reason: https://stackoverflow.com/questions/38338475/no-database-provider-has-been-configured-for-this-dbcontext-on-signinmanager-p
HTTP Error 500.30 - ANCM In-Process Start Failure
Possible Cuase and solution 1
- Question: https://stackoverflow.com/questions/53811569/http-error-500-30-ancm-in-process-start-failure
- Worked answer: https://stackoverflow.com/a/59390437/4802664
Possible Cuase and solution 2
- If you are accessing KeyVault as code shown below
- Currently logged in user in Visual Studion does not have access right to the secret (KeyVault access policy)
Program.cs
// CreateHostBuilder()
var builtConfig = config.Build();
var keyVaultName = builtConfig[builtConfig["KeyVaultNameIdentifierKey"]];
var secretClient = new SecretClient(new Uri($"https://{keyVaultName}.vault.azure.net/"), new DefaultAzureCredential());
config.AddAzureKeyVault(secretClient, new KeyVaultSecretManager());
// ... ... ...
Solution
- Got to KeyVault
- Add access policy for currently logged in user (the user who is currently logged in to Visual Studio)
InvalidOperationException: The ConfigureServices method must either be parameterless or take only one parameter of type IServiceCollection
Reason: you tried to add parameter to ConfigureServices
for DI i.e. IWebHostEnvironment env
// ... ... ...
public void ConfigureServices(IServiceCollection services, IWebHostEnvironment env)
{
services.AddRazorPages();
services.AddServerSideBlazor();
if (env.IsDevelopment())
{
}
}
Splution: remove added parameter and use constructor injection
// ... ... ...
public IWebHostEnvironment Environment { get; set; }
public Startup(IConfiguration configuration, IWebHostEnvironment env) // constructor injection
{
Configuration = configuration;
Environment = env;
}
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
if (Environment.IsDevelopment())
{
}
}