我正在运行自我托管的南希网络应用程序,在自己和有问题的静态内容。
假设我的应用程序是从这个文件夹运行的:
C:/我的文件夹/
我的观点如下:
C:/我的文件夹/经理/视图/
因此,在我的浏览器中,我可以访问http://localhost:85/Manager并加载页面。
不过,我不能让它提供静态内容,我所有的文件都在/Content文件夹中,我试图将它同时放置到/myfolder和/Manager文件夹中,没有任何结果。
http://localhost:85/Manager/Content/css/styles.css和http://localhost:85/Content/css/styles.css urls都不起作用。
我怎么才能让它起作用?
发布于 2015-02-10 18:21:58
通过将这些代码行添加到Startup中,修正了这个问题:
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.StaticFiles;
...
var options = new FileServerOptions()
{
RequestPath = PathString.Empty,
FileSystem = new PhysicalFileSystem("/Path/here")
};
app.UseFileServer(options);https://stackoverflow.com/questions/28345526
复制相似问题