2016-10-02 6 views
1

Ich erstelle und eckige 2 App mit asp.net Kern. Ich habe beim Erstellen des Projekts die neueste 4.6.1 DotNetFramwork-Version ausgewählt. Ich habe auch die Glimpse-Paketversion "2.0.0-beta1" hinzugefügt. Ich habe Probleme in der startup.cs-Datei als Konflikt mit der Version der IApplicationBuilder-Schnittstelle bekommenKann Glimpse nicht verwenden. Mehrdeutigkeit in IApplicationBuilder-Paket

Ich bekomme Mehrdeutigkeit Fehlermeldung für IApplicationBuilder in Configure-Methode der startup.cs-Datei. Wenn ich Microsoft.AspNetCore.Builder.IApplicationBuilder Paket auswähle, erhalte ich einen Kompilierungsfehler, der besagt, dass IApplicationBuilder keine Definition für UseIISPlatformHandler und UseGlimpse enthält.

Wenn ich die Microsoft.AspNet.Builder.IApplicationBuilder wählen dann wirft sie sagen, dass IApplicationBuilder nicht Definition enthält für UseBrowserLink, UseDeveloperExceptionPage, UseExceptionHandler und UseIISPlatformHandler.

Ich bin fest und nicht sicher, wie Sie das beheben. Brauchen Sie Glimpse in meinem Projekt zu verwenden.

Könnte jemand helfen?

Unten ist die Kopie meines project.json und startup.cs

project.json

{ 
    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "version": "1.0.1", 
     "type": "platform" 
    }, 
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0", 
    "Microsoft.AspNetCore.Diagnostics": "1.0.0", 
    "Microsoft.AspNetCore.Mvc": "1.0.1", 
    "Microsoft.AspNetCore.Razor.Tools": { 
     "version": "1.0.0-preview2-final", 
     "type": "build" 
    }, 
    "Microsoft.AspNetCore.Routing": "1.0.1", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", 
    "Microsoft.AspNetCore.StaticFiles": "1.0.0", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0", 
    "Microsoft.Extensions.Logging": "1.0.0", 
    "Microsoft.Extensions.Logging.Console": "1.0.0", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0", 
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", 
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0", 
    "Glimpse": "2.0.0-beta1" 
    }, 

    "tools": { 
    "BundlerMinifier.Core": "2.0.238", 
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final", 
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final" 
    }, 

    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": [ 
     "dotnet5.6", 
     "portable-net45+win8" 
     ] 
    } 
    }, 

    "buildOptions": { 
    "emitEntryPoint": true, 
    "preserveCompilationContext": true 
    }, 

    "runtimeOptions": { 
    "configProperties": { 
     "System.GC.Server": true 
    } 
    }, 

    "publishOptions": { 
    "include": [ 
     "wwwroot", 
     "**/*.cshtml", 
     "appsettings.json", 
     "web.config" 
    ] 
    }, 

    "scripts": { 
    "prepublish": [ "bower install", "dotnet bundle" ], 
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 
    } 
} 

startup.cs

using Glimpse; 
using Microsoft.AspNet.Builder; 
using Microsoft.AspNet.Hosting; 
using Microsoft.AspNetCore.Builder; 
using Microsoft.Extensions.Configuration; 
using Microsoft.Extensions.DependencyInjection; 
using Microsoft.Extensions.Logging; 


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


     public Startup(IHostingEnvironment env) 
     { 
      // Set up configuration sources. 
      var builder = new ConfigurationBuilder() 
       .AddJsonFile("appsettings.json") 
       .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); 

      builder.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) 
     { 
      services.AddGlimpse(); 
      services.AddMvc(); 
     } 

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

      if (env.IsDevelopment()) 
      { 
       app.UseBrowserLink(); 
       app.UseDeveloperExceptionPage(); 
      } 
      else 
      { 
       app.UseExceptionHandler("/Home/Error"); 
      } 

      app.UseIISPlatformHandler(options => 
             options.AuthenticationDescriptions.Clear()); 
      app.UseStaticFiles(); 
      app.UseGlimpse(); 

      app.UseMvc(routes => 
      { 
       routes.MapRoute("default", 
           "{controller=Home}/{action=Index}/{id?}"); 
       routes.MapRoute("spa-fallback", 
           "{*anything}", 
           new { controller = "Home", action = "Index" }); 
       routes.MapWebApiRoute("defaultApi", 
             "api/{controller}/{id?}"); 
      }); 
     } 

    } 
} 
+0

Sie eine Lösung für diese gefunden? – Paul

+0

Hatte das gleiche Problem und befolgte diese Anweisungen und es funktionierte: https://github.com/Glimpse/Glimpse.Prototype/issues/123#issuecomment-276980579 –

Antwort

0

Glimpse 2 Beta-Datei 1 unterstützt .NET Core RC1.

Versuchen Glimpse 2 Beta 2 von der NuGet Feed unter Verwendung von https://www.myget.org/gallery/glimpseprototype für .NET Core-RTM-Support

+1

Ich habe versucht, den Eintrag "Glimpse": "2.0.0-beta2 "In der Datei project.json wurde auch die URL https://www.myget.org/gallery/glimpseprototype zu den Einstellungen Paketquelle im NugetManager meines Visual Studio 2015 Editors hinzugefügt. Es lädt die Bibliothek nicht herunter und installiert sie nicht. Irgendwelche Hinweise – Mike