- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
**编辑:注意:这似乎在 Owin StaticFiles 中间件的更高版本中得到修复,因此如果您有此问题,只需升级 **
我的 OWIN 配置有这个:-
string root = AppDomain.CurrentDomain.BaseDirectory;
var staticFilesOptions = new StaticFileOptions();
staticFilesOptions.RequestPath = new PathString("/foo");
staticFilesOptions.FileSystem = new PhysicalFileSystem(Path.Combine(root, "web"));
app.UseStaticFiles(staticFilesOptions);
/foo/app/app.js
当我点击
/web/app/app.js
时,我收到 404 错误文件被返回。
RequestPath
旨在与
PhysicalFileSystem
一起工作?
最佳答案
我测试了这个代码片段,它对我有用 this sample project .
app.UseFileServer(new FileServerOptions()
{
RequestPath = new PathString("/foo"),
FileSystem = new PhysicalFileSystem(@".\web"),
});
<system.webServer>
...
<modules runAllManagedModulesForAllRequests="true"></modules>
...
</system.webServer>
关于Owin UseStaticFiles 不尊重 RequestPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22387555/
**编辑:注意:这似乎在 Owin StaticFiles 中间件的更高版本中得到修复,因此如果您有此问题,只需升级 ** 我的 OWIN 配置有这个:- string root = AppDo
我正在使用最新版本的 Visual Studio Code (v0.3) 来玩新的 ASPNET 5 beta。我不想把 VS2015 RC 放在我的工作机器上。我有一个准系统(Hello World
我使用的是Asp.Net Core 2.2,我总是使用下面的代码作为静态文件的缓存控制: var cachePeriod = env.IsDevelopment() ? "600" : "259200
我使用 OWIN 能够通过 Windows 服务中的 http 提供静态内容。(嵌入 Windows 服务的 Web 管理工具)。 我遇到一些奇怪的行为: 当我运行该服务时,我只能访问“web”文件夹
我尝试了不同版本的 StaticFiles。但它显示错误,因为 IApplicationBuilder 不包含 UseStaticFiles()。 "Microsoft.AspNetCore.Stat
我想从我的网络 API 访问多个文件夹位置以显示图像。我无法更改文件夹位置(取决于我无权修改任何内容的设备)。 对于我做的其中一个文件夹: string FolderToListen = Config
我理解中间件的注册顺序may matter .然而,这并不是必然如此。 我注意到 UseDefaultFiles() 需要在 UseStaticFiles() 之前(这可以巧妙地被 UseFileSe
严重性代码描述项目文件行错误 CS1061“IApplicationBuilder”不包含“UseStaticFiles”的定义,并且找不到接受“IApplicationBuilder”类型的第一个参
我有一个也使用 Angular 的 ASP.Net Core 应用程序。在我的本地机器上,它能够提供静态文件,例如js和图像。部署到 Azure 时,对静态文件的调用会返回默认路由(检索 Angula
我有一个也使用 Angular 的 ASP.Net Core 应用程序。在我的本地机器上,它能够提供静态文件,例如js和图像。部署到 Azure 时,对静态文件的调用会返回默认路由(检索 Angula
我使用以下命令创建了 .net core 2.0 mvc 应用程序:“dotnet new mvc”,它运行没有任何问题,但在 vscode 中我有两个错误: 'IServiceCollection'
我还找不到很多合适的 Core 1.0 教程,但是当我用 google 搜索方法名称时,我得到了无数示例,这些示例说要包含在 Startup.cs 中: app.UseDefaultFiles();
我正在尝试将 asp.net 核心应用程序部署到 docker 容器中。该应用程序是使用 dotnet new mvc 创建的。当应用程序在非 docker 环境中运行时一切正常。但是,在 docke
我在这两者之间感到困惑。在 ASP.NET Web 应用程序中应该使用什么以及何时使用? 最佳答案 UseFileServer 包括 UseStaticFiles、UseDefaultFiles 和可
ASP.NET Core 2.1.1 为 appBuilder 提供了几个看似相关的扩展方法: UseStaticFiles 来自 Microsoft.AspNetCore.StaticFiles U
我是一名优秀的程序员,十分优秀!