-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I tested v2 and works fine on IIS local deployment with Alias, but in v3 I received these errors only on local IIS:
Exception
System.FormatException: The format of value '<null>' is invalid.
at System.Net.Http.Headers.HttpHeaderParser.ParseValue(String value, Object storeValue, Int32& index)
at System.Net.Http.Headers.AuthenticationHeaderValue.Parse(String input)
at Serilog.Ui.Web.Authorization.Filters.BasicAuthenticationFilter.AuthorizeAsync()
at Serilog.Ui.Web.Authorization.AuthorizationFilterService.CanAccessAsync()
at Serilog.Ui.Web.Authorization.AuthorizationFilterService.CheckAccessAsync(Func`1 onSuccess, Func`1 onFailure)
at Serilog.Ui.Web.Endpoints.SerilogUiAppRoutesDecorator.GetHomeAsync()
at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
Properties
<properties><property key='ConnectionId'>18230571306091327259</property><property key='TraceIdentifier'>8000af1c-0003-fd00-b63f-84710c7967bb</property><property key='EventId'><structure type=''><property key='Id'>2</property><property key='Name'>ApplicationError</property></structure></property><property key='SourceContext'>Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer</property><property key='RequestId'>8000af1c-0003-fd00-b63f-84710c7967bb</property><property key='RequestPath'>/eCFMPS/serilog-ui/</property></properties>
I've tested these codes, commented lines are for v2.0;
// Services
services.AddSerilogUi(options => options
//.AddScopedBasicAuthFilter()
.AddScopedAuthorizeLocalRequestsAuthFilter()
.AddScopedBasicAuthFilter()
.UseSqlServer(opts => opts
.WithConnectionString(Misc.Helpers.ConfigurationSectionValue(configuration, "Serilog:WriteTo", "Args:connectionString")!)
.WithTable(Misc.Helpers.ConfigurationSectionValue(configuration, "Serilog:WriteTo", "Args:sinkOptionsSection:tableName")!)));
app.UseSerilogUi(options =>
{
// v2.0
// //options.Authorization.Filters =
// //[
// // new BasicAuthenticationFilter { UserName = "mpssa", Password = "12qwasZX" }
// //];
// //options.Authorization.RunAuthorizationFilterOnAppRoutes = true;
var PathBase = "eCFMPS";
//if (!string.IsNullOrWhiteSpace(PathBase))
//{
// //options.WithHomeUrl(PathBase);
// options.WithRoutePrefix(PathBase);
//}
options.EnableAuthorizationOnAppRoutes();
options.WithExpandedDropdownsByDefault();
options.HideSerilogUiBrand();
options.WithAuthenticationType(Serilog.Ui.Web.Models.AuthenticationType.Basic);
});
On debug mode it works fine but on deployment (Release mode) with an Alias like http://localhost/ecfMPS it failed... I try PathBase option as swell.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working