【问题标题】:"An error occurred attempting to determine the process id of dotnet.exe"“尝试确定 dotnet.exe 的进程 ID 时发生错误”
【发布时间】:2017-02-20 13:09:47
【问题描述】:

我正在构建一个启用 SSL 的 dotnet 核心 APIm。当我尝试运行时,出现以下错误:

尝试确定托管应用程序的 dotnet.exe 的进程 ID 时发生错误。发生了一个或多个错误。

我查看了无数讨论此问题的页面(StackOverflow 和其他),并且我了解它可能发生的主要原因。但是...我几乎可以肯定它们都不是我的问题。

首先,当我关闭 SSL 并尝试在没有它的情况下运行时仍然出现错误。其次,当我经历“修复”或重新安装不同的 dotnet core/iis 的过程时,它可以工作。工作一段时间后,它会停止(我想可能是在 Visual Studio 关闭时)。

我无法找到任何关于它何时开始工作的模式,但我相信它会在 Visual Studio 2015 关闭时停止。

这是我做的一些事情,它们可能会或可能不会暂时起作用:

  • 修复 IIS,给我一个 localhost 的 https 证书
  • 使用 SSL 地址打开 firefox 或 edge(在没有调试的情况下运行后)以确保其具有证书(或证书豁免)
  • 修复/卸载/重新安装 dotnet core
  • 从本地用户中删除 IIS Express 文件

请有人给我一些建议,或者帮助找出具体问题的步骤?

在我们升级到 Visual Studio 2017 之前,我可以使用一些替代方法吗?

附加信息:

  • 我有时会使用 VPN

  • project.json

	{
	  "dependencies": {
		"Microsoft.NETCore.App": {
		  "type": "platform",
		  "version": "1.1.0"
		},
		"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-*",
		"Microsoft.Extensions.Logging.Console": "1.1.0",
		"Microsoft.AspNetCore.Diagnostics": "1.1.0",
		"Microsoft.AspNetCore.Mvc": "1.1.0",
		"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
		"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
		"Microsoft.EntityFrameworkCore": "1.1.0",
		"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
		"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
		"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
		"Microsoft.Extensions.Configuration.Json": "1.1.0",
		"AutoMapper": "5.2.0",
		"Swashbuckle": "6.0.0-beta902",
		"Microsoft.Extensions.Logging.Debug": "1.1.0",
		"Microsoft.IdentityModel.Tokens": "5.1.2",
		"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
		"OpenIddict": "1.0.0-*",
		"OpenIddict.EntityFrameworkCore": "1.0.0-*",
		"OpenIddict.Mvc": "1.0.0-*",
		"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.0.0",
		"Microsoft.AspNetCore.Server.Kestrel.Https": "1.0.1",
		"AspNet.Security.OAuth.Validation": "1.0.0-*" 
	  },

	  "tools": {
		"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-*"
	  },

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

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

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

	  "publishOptions": {
		"include": [
		  "wwwroot",
		  "web.config",
		  "appsettings.json",
		  "appsettings.production.json",
		  "appsettings.development.json",
		  "appsettings.labs.json",
		  "Resources\\testCert.pfx",
		  "Resources\\SiteWildcard.pfx"
		]
	  },

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

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "https://localhost:44345/",
      "sslPort": 44345
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "App.Api": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}

【问题讨论】:

标签: visual-studio asp.net-web-api visual-studio-2015 .net-core iis-express


【解决方案1】:

我想我刚刚弄清楚它是什么......只有在 VPN 处于活动状态时才会发生这种情况。如果我断开 VPN,它会再次工作。我不知道如何在 VPN 处于活动状态时让它工作的解决方案,但我对目前的工作感到很满意。

这可能会在未来对任何被困在同一位置的人有用。对我来说,它有时工作有时不工作的困惑是因为我必须激活和停用 VPN 才能连接到某些东西。

【讨论】:

    【解决方案2】:

    https://support.microsoft.com/en-us/help/3180222/warnings-about-an-untrusted-certificate-after-you-install-visual-studio-2015-update-3

    上面的链接对我有用。

    您需要从 Windows 搜索栏中打开 Windows PowerShell ISE 并输入以下命令:

    ipmo PKI
    $name = [GUID]::NewGuid()
    $cerFile = "$env:TEMP\$name.cer"
    $certs = Get-ChildItem Cert:\LocalMachine\My -DnsName localhost -SSLServerAuthentication | ? {($_.FriendlyName -eq 'IIS Express Development  Certificate') -and ($_.SignatureAlgorithm.FriendlyName -ieq 'sha256RSA') -and ($_.EnhancedKeyUsageList.Count -eq 1)}
    if ($certs.Count -eq 0)
    {
    Write-Error 'Cannot find any SHA256 certificate generated by IIS Express.   Please make sure that the latest version of IIS Express is installed.'
    }
    else
    {
    foreach ($cert in $certs)
    {
        Export-Certificate -Cert $cert.PSPath -FilePath $cerFile -Type CERT |    Out-Null
        Import-Certificate -FilePath $cerFile -CertStoreLocation    Cert:\CurrentUser\Root | Out-Null
        Remove-Item $cerFile -Force
    }
    Write-Host 'Successfully installed the certificate to Trusted Root Certification Authorities of the current user.'
    }
    

    如果上面的代码不起作用,请转到链接并复制它。 然后您将收到一条警告消息,单击是。 接下来使用 windows search 搜索 mmc 以打开 Microsoft 管理控制台。

    然后,您可以从网站上关注其余内容。希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-19
      • 1970-01-01
      • 1970-01-01
      • 2016-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多