c# - asp.net core项目发布后iis立即关闭

标签 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();

最佳答案

我可以重现此行为,我很确定这是由于缺少 .NET Core 1.1 运行时库造成的。当您转到 C:\Program Files\dotnet\shared\Microsoft.NETCore.App 时,您可能看不到“1.1.0”目录。

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

注意如果您确实尝试(正如我在我的一条评论中所建议的那样)删除 "type": "platform"行(并添加运行时部分(取决于您的 Windows 版本),那么您会发现它不会崩溃。没有必须安装运行时/SDK。

关于c# - asp.net core项目发布后iis立即关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40701879/

相关文章:

c# - 无效的用户名/密码

c# - 将 PENDING 锁设置为 EF core Sqlite

c# - 连接字符串而不重复分隔符

c# - 如何获取与 IWpfTextView 关联的 EnvDTE.Document?

c# - 未找到 signtool.exe?

C++ GetDC 所有监视器

c# - 错误 9 无法加载 Bootstrap 。设备连接组件

c# - 单元测试适配器抛出异常 : Object must implement IConvertible. .in BDD specflow 框架

ASP.Net MVC 5 通过ajax加载列表数据

c# - 将 MYSQL 查询合并到一个 GridView 中