"An error occurred attempting to determine the process id of dotnet.exe"

"An error occurred attempting to determine the process id of dotnet.exe"

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

An error occurred attempting to determine the process id of dotnet.exe which is hosting your application. One or more errors occurred.

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

首先,当我关闭 SSL 并尝试 运行 时仍然出错。其次,当我经历 "repairing" 或重新安装不同的 dotnet core/iis 的过程时,它可以表达它的作用。工作一段时间后,它会停止(我想可能是在 Visual Studio 关闭时)。

我一直找不到关于它何时开始工作的任何模式,但我相信它会在 Visual Studio 2015 年结束时停止。

以下是我所做的一些事情,可能会或可能不会暂时生效:

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

或者在我们升级到 Visual Studio 2017 之前,我可以使用某种解决方法?

附加信息:

 {
   "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%" ]
   }
 }

{
  "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"
      }
    }
  }
}

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

这在将来可能对任何陷入相同境地的人都有用。对我来说,它有时有效有时无效的困惑是因为我必须激活和停用 VPN 才能连接到某些东西。

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

以上 link 对我有用。

您需要从 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.'
}

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

然后您可以关注网站上的其余部分。希望对你有帮助