1

为什么“开箱即用”的 aspnet5 Web 应用程序项目不能在框架部分设置为 TFM“net46”或“net451”的情况下运行。我只能让它运行设置为“dnx451 或 dnx46”。如果我在任何“netxx”绰号下运行它,我会在浏览器中收到连接被拒绝,而不是在 aspnet 启动页面中。

使用最新的运行时

更新 1 当我在 project.json 文件中将 TFM 切换到“net46”时,我得到以下信息,那么为什么它仍然针对 dnx 4.5.1 运行时?当前的 dnvm 显示如上,在另一个说明中,您也可以在 VS2015 中的调试按钮下的下拉列表中从 IISExpress 切换到 web。

C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\WebApplication2>dnx web
System.InvalidOperationException: The current runtime target framework is not compatible with 'WebApplication2'.
Current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)'
 Version:      1.0.0-rc1-16231
 Type:         Clr
 Architecture: x86
 OS Name:      Windows
 OS Version:   10.0
 Runtime Id:   win10-x86

Please make sure the runtime matches a framework specified in project.json
   at Microsoft.Dnx.ApplicationHost.DefaultHost.GetEntryPoint(String applicationName)
   at Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
   at Microsoft.Dnx.ApplicationHost.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, String appBase, FrameworkName targetFramework)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, BootstrapperContext bootstrapperContext)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, BootstrapperContext bootstrapperContext)

C:\Users\Doug\Documents\Visual Studio 14\Projects\WebApplication2\src\WebApplication2>dnvm list

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
       1.0.0-rc1-update1 clr     x64          win
  *    1.0.0-rc1-update1 clr     x86          win             default
       1.0.0-rc1-update1 coreclr x64          win
       1.0.0-rc1-update1 coreclr x86          win

仅供参考,这是 aspnet5 的开箱即用 WebApplication 项目,这是我的 project.json

{
  "userSecretsId": "aspnet5-WebApplication2-59e2cf64-0111-49ef-89d6-ab19ba2a9788",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "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.Configuration.UserSecrets": "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",
    "ef": "EntityFramework.Commands"
  },

  "frameworks": {
    "net46": { }  <--- THIS HAS TO BE DNX45,DNX451, or DNX46 for it to run
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}
4

0 回答 0