且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Owin UseStaticFiles不遵守RequestPath

更新时间:2023-10-01 23:35:52

我测试了此代码段,并从

I tested this code snippet and it works for me from this sample project.

app.UseFileServer(new FileServerOptions()
{
    RequestPath = new PathString("/foo"),
    FileSystem = new PhysicalFileSystem(@".\web"),
});

确保您的web.config中包含此文件:

Make sure you have this in your web.config:

<system.webServer>
    ...
    <modules runAllManagedModulesForAllRequests="true"></modules>
    ...
</system.webServer>