Microsoft.AspNet.IISPlatformHandler Asp.Net5 的依赖性问题

Microsoft.AspNet.IISPlatformHandler dependency issue with Asp.Net5

当我尝试使用以下方法做一个简单的应用程序时,出现以下错误 ASP.NET 5 个 RC1。请帮我解决这个问题。不确定,我在哪里犯了错误:(请做有需要的。非常感谢您的提前帮助。

Project.json

{
  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },
  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final"
  },
  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "frameworks": {
    "dnx451": {
      "dependencies": {
        "Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
        "Microsoft.AspNet.Mvc": "6.0.0-rc1-final"      
      }
    },
    "dnxcore50": {
      "dependencies": {  }
     }
  },
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "version": "1.0.0-*",
  "webroot": "wwwroot"
}

Startup.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Framework.DependencyInjection;

namespace MVA5
{
    public class Startup
    {
        // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection services)
        {
            services.AddMvc();
        }

        public void Configure(IApplicationBuilder app)
        {
            // Add the platform handler to the request pipeline.
            app.UseIISPlatformHandler();

            app.UseMvcWithDefaultRoute();

            //app.Run(async (context) =>
            //{ 
            //    await context.Response.WriteAsync("Hello World!");
            //});
        }
    }
}

DNVM 列表

确保您使用 1.0.0-rc1-final 运行时。

对于控制台的类型:dnvm list 如果您不使用 1.0.0-rc1-final 运行时,请在控制台中输入:dnvm upgrade。

您的 project.json 中列出了 2 个目标框架(TFM 或目标框架名称):dnx451dnxcore50。因此,当您进行构建时,它是为这两个框架构建的。

现在,由于 "Microsoft.AspNet.Mvc" 的依赖项仅作为 dnx451 的一部分列出,因此在为 dnxcore50 构建时构建失败(我同意错误列表可能不是很清楚)。

尝试将 "Microsoft.AspNet.Mvc.Core""Microsoft.AspNet.Mvc" 依赖项移动到两个 TFM 共有的 dependencies 节点,然后进行构建。