app.MapWhen(context => context.Request.Path == "/Contact",
appBuilder => appBuilder.Run(async context =>
{
var options = new DefaultFilesOptions();
options.DefaultFileNames.Clear();
options.DefaultFileNames.Add("contact.html");
appBuilder.UseDefaultFiles(options);
appBuilder.UseFileServer();
})
);
void home(IApplicationBuilder appBuilder)
{
appBuilder.Run(async (context) =>
{
context.Response.ContentType = "text/html; charset=utf-8";
var options = new DefaultFilesOptions();
options.DefaultFileNames.Clear();
options.DefaultFileNames.Add("index.html");
app.UseDefaultFiles(options);
app.UseStaticFiles();
});
}
app.Map("/Home" , home);
InvalidOperationException: Sequence contains more than one matching element
System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
TypeInitializationException: The type initializer for 'Microsoft.EntityFrameworkCore.Query.QueryableMethods' threw an exception.
Microsoft.EntityFrameworkCore.Query.QueryableMethods.get_FirstWithPredicate()
TypeInitializationException: The type initializer for 'Microsoft.EntityFrameworkCore.Query.Internal.NavigationExpandingExpressionVisitor' threw an exception.