Why the TestServer (AspNetCore) gives 404 error on static files?

后端 未结 2 560
清歌不尽
清歌不尽 2021-01-16 16:04

I have a sample server

var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
               


        
2条回答
  •  别那么骄傲
    2021-01-16 16:43

    XUnit starts the site from a different directory. We've had to work around it like this: https://github.com/aspnet/StaticFiles/blob/d692066b2bd711653150ad2cccc2268583355532/test/Microsoft.AspNetCore.StaticFiles.Tests/StaticFilesTestServer.cs#L20

提交回复
热议问题