2016-05-13 8 views
0

私は自分のasp.net5プロジェクトにリンクしたいと思うhtmlファイルindex.htmlを手に入れました。ASP.NET5.0 htmlファイルを追加

私はwwwrootにindex.htmlを追加しようとしましたが、デバッグを開始すると私はlocalhost:port/index.htmlに行きます。

ドキュメントにリンクする方法や説明する方法はありますか?

PS:私はvisual-studioを使用しています。

コンフィグコード:

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 
    public void Configure(IApplicationBuilder app) 
    { 
     app.UseIISPlatformHandler(); 
     app.Run(async (context) => 
     { 

      await context.Response.WriteAsync("test"); 
     }); 

    } 

答えて

1

あなたは静的ファイルを使用したいアプリを伝える必要があります。たとえば、Web Api 2.0サーバーには必要ありません。したがって、これはデフォルトでは追加されません。 Startup.csにapp.UseStaticFiles()を追加します。 Configureメソッドに渡します。

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 
{  
    app.UseIISPlatformHandler(); 
    app.UseStaticFiles(); 
    app.UseMvc(); 
} 
+0

こんにちは応答をありがとうしかし、私は唯一のapp.UseIISPlatformHandlerとapp.UseMiddleware – Sakon

+0

「Microsoft.AspNet.StaticFiles」を取得静的なファイル使用し得るいけない: –

+0

追加、「1.0.0-RC1-最終的に」あなたのプロジェクトの依存関係 –

関連する問題