KestrunHost.AddFileServer method (1 of 2)

Adds a file server middleware to the application. This middleware serves static files and default files from a specified file provider.

public KestrunHost AddFileServer(Action<FileServerOptions>? cfg = null)
parameter description
cfg Configuration options for the file server middleware.

Return Value

The current KestrunHost instance.

See Also


KestrunHost.AddFileServer method (2 of 2)

Adds a file server middleware to the application.

public KestrunHost AddFileServer(FileServerOptions? cfg, 
    CacheControlHeaderValue? cacheControl = null)
parameter description
cfg Configuration options for the file server middleware.
cacheControl Optional cache control headers to apply to static file responses.

Return Value

The current KestrunHost instance.

Remarks

This middleware serves static files and default files from a specified file provider. If no configuration is provided, it uses default settings.

See Also