2015-02-05 39 views
0

我正在Owin上運行自己託管的南希網絡應用程序並有靜態內容的麻煩。南希在歐文不服務靜態內容

比方說,我的應用程序從這個文件夾中運行:

C:/ MyFolder文件/

我的意見在這裏:

C:/ MyFolder文件/經理/瀏覽次數/

所以在我的瀏覽器中我可以去http://localhost:85/Manager和我的頁面加載。

雖然我根本無法提供靜態內容,但是我的所有文件都在/ Content文件夾中,我試圖將它放在/ myfolder和/ Manager文件夾中,但沒有運氣。

無論http://localhost:85/Manager/Content/css/styles.css也不http://localhost:85/Content/css/styles.css網址的工作

我如何得到它的工作?

回答

0

通過添加這些代碼行修正的問題Startup

using Microsoft.Owin.FileSystems; 
using Microsoft.Owin.StaticFiles; 

... 

var options = new FileServerOptions() 
{ 
    RequestPath = PathString.Empty, 
    FileSystem = new PhysicalFileSystem("/Path/here") 
}; 
app.UseFileServer(options);