iis在发布asp.net核心项目后立即关闭

时间:2016-11-20 07:59:42

标签: c# asp.net visual-studio iis asp.net-core

尝试调试我的asp.net核心项目后,IIS Express立即关闭。 我正在使用visual studio 2015 update 3。

提前致谢

我的包很好但是为了完整性,这里是project.json:

 "dependencies": {
"Microsoft.NETCore.App": {
  "version": "1.1.0",
  "type": "platform"
},
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Routing": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-preview1-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "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.1.0",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final"
}, 
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
   "netcoreapp1.1.0": {     
    }
},
 "buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
 "runtimeOptions": {
"configProperties": {
  "System.GC.Server": true
  }
},

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

"scripts": {
  "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath%    --framework %publish:FullTargetFramework%" ]
 }

这是我的初创班:

  loggerFactory.AddConsole(Configuration.GetSection("Logging"));
  loggerFactory.AddDebug();
  app.UseMvc();

1 个答案:

答案 0 :(得分:5)

我可以重现这种行为,我很确定这是由于缺少.NET Core 1.1运行时库引起的。当您转到C:\ Program Files \ dotnet \ shared \ Microsoft.NETCore.App时,您可能无法看到' 1.1.0' 。目录

转到https://www.microsoft.com/net/download/core安装SDK库(选择当前和SDK)。

N.B。如果您尝试(正如我在其中一条评论中所建议的那样)删除"类型":"平台" line(并添加运行时部分(取决于您的Windows版本),然后您将看到它不会崩溃。无需安装运行时/ SDK。