2016-03-25 8 views
0

私はVS 2015で新しいプロジェクトを開始しています。ASP.NET 5テンプレートが初めて実行されるとクラッシュする

ファイル - >新規 - >プロジェクト - > ASP.NET Webアプリケーション - > ASP.NET 5テンプレート - > Web API

プロジェクトが初期化されました。私は、IIS Expressを使ってプロジェクトを実行すると、サービスが利用できると思います。

起動方法を実行します。

public class Startup 
{ 
    public Startup(IHostingEnvironment env) 
    { 
     // Set up configuration sources. 
     var builder = new ConfigurationBuilder() 
      .AddJsonFile("appsettings.json") 
      .AddEnvironmentVariables(); 
     Configuration = builder.Build(); 
    } 

    public IConfigurationRoot Configuration { get; set; } 

    // This method gets called by the runtime. Use this method to add services to the container. 
    public void ConfigureServices(IServiceCollection services) 
    { 
     // Add framework services. 
     services.AddMvc(); 
    } 

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 
    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 
    { 
     loggerFactory.AddConsole(Configuration.GetSection("Logging")); 
     loggerFactory.AddDebug(); 

     app.UseIISPlatformHandler(); 

     app.UseStaticFiles(); 

     app.UseMvc(); 
    } 

    // Entry point for the application. 
    public static void Main(string[] args) => 
     WebApplication.Run<Startup>(args); 
} 

}

しかし、それがクラッシュします。グローバルなエラー処理の実装方法はわかりません。

私はthis exampleを見ました。

しかし、System.Net.HttpまたはSystem.Web.Http.ExceptionHandlingを使用しようとすると、それらを見つけることができません。

また、インテリセンスでは、Core 5.0は利用できないと言いました。

ここに私のproject.jsonがあります。

{ 
    "version":"1.0.0-*", 
    "compilationOptions":{ 
     "emitEntryPoint":true 
    }, 
    "dependencies":{ 
     "Microsoft.AspNet.IISPlatformHandler":"1.0.0-rc1-final", 
     "Microsoft.AspNet.Mvc":"6.0.0-rc1-final", 
     "Microsoft.AspNet.Server.Kestrel":"1.0.0-rc1-final", 
     "Microsoft.AspNet.StaticFiles":"1.0.0-rc1-final", 
     "Microsoft.Extensions.Configuration.FileProviderExtensions":"1.0.0-rc1-final", 
     "Microsoft.Extensions.Configuration.Json":"1.0.0-rc1-final", 
     "Microsoft.Extensions.Logging":"1.0.0-rc1-final", 
     "Microsoft.Extensions.Logging.Console":"1.0.0-rc1-final", 
     "Microsoft.Extensions.Logging.Debug":"1.0.0-rc1-final" 
    }, 
    "commands":{ 
     "web":"Microsoft.AspNet.Server.Kestrel" 
    }, 
    "frameworks":{ 
     "dnx451":{ 
     "frameworkAssemblies":{ 
      "System.Web":"4.0.0.0" 
     } 
     }, 
     "dnxcore50":{ 

     } 
    }, 
    "exclude":[ 
     "wwwroot", 
     "node_modules" 
    ], 
    "publishExclude":[ 
     "**.user", 
     "**.vspscc" 
    ] 
} 
+0

project.jsonを共有できますか? 'dnvm'をインストールしましたか? 'dnu build'コマンドの出力も共有してください。 –

答えて

0

は、Visual Studioの管理者モードに

+0

これは役に立たなかった – mac10688

0

を開こう私はそれがクラッシュしているものに依存推測する - それがクラッシュすると、それがクラッシュしたかときには、クラッシュどのようなあなたの説明から明らかではありません。

エラー処理ページを構成するには、UseExceptionHandlerUseDeveloperExceptionPage拡張メソッドを使用できます。このarticleはそれをより詳細に説明しています。 起動時に例外が発生した場合は、UseCaptureStartupErrors拡張メソッド(最近はrenamedCaptureStartupErrors)を使用する必要があります。 また、すでにログが有効になっています。ログには有用な情報が含まれている場合もあります。コンソールにログするためログが表示されない場合は、ファイルにロギングすることを検討してください。

これがIIS/IISExpressクラッシュチェックイベントログの場合。

+0

私はあなたのアイデアが好きですが、UseDeveloperExceptionPageやその他のものを使用しようとするとコンパイラエラーが発生します。それは私が依存を見逃しているように見え、私はそれを診断する方法を知らない。 VNextは依存関係が異なります。私は黄色の感嘆符は表示されません。 – mac10688

+0

イベントログを調べましたが、何も見つかりませんでした。私はアプリケーションを走らせてクラッシュさせたが、イベントログに新しく何も現れなかった。最近の出来事をすべてのフォルダで調べました。 – mac10688

+0

UseDeveloperExceptionPageを使用するには、 'Microsoft.AspNet.Diagnostics'に依存する必要があります。 – Pawel

0

ランタイムバージョンとは何ですか?

多分あなたはAspNet Yeoman generatorでアプリケーションを足場で試して、それらのファイルを比較することができます。 個人的には、足場を頻繁に最新のものとして使用することを好みます。

希望すると便利です。

関連する問題