【问题标题】:Unable to debug ASP.NET 5 using IIS Express with Visual Studio 2015无法使用 IIS Express 和 Visual Studio 2015 调试 ASP.NET 5
【发布时间】:2016-08-25 01:08:09
【问题描述】:

当我尝试在 Visual Studio 2015 中调试 asp.net 5 应用程序时,出现以下错误 “尝试确定托管您的应用程序的 DNX 进程的进程 ID 时发生错误”

更新 2

它只发生在 Windows 10 中。我用 Windows 7 进行了测试,我做到了 不会遇到这个错误。

我可以在 Visual Studio 2015 中使用“web”选项运行,但 IIS Express 发生错误。当我点击 ctrl+F5(不调试运行)时,浏览器窗口打开,然后什么也不做(光标永远旋转)。

工具栏快照

输出 -> 调试窗口是空的,所以不确定这个错误的根本原因是什么。不确定是否还有其他地方我需要查找更多错误详细信息。

我有

Microsoft Visual Studio Professional 2015 Version 14.0.25123.00 Update 2 
Microsoft .NET Framework Version 4.6.01038
Windows 10 pro v1511 OS build 10586.218  
DNVM 1.0.0-rc1-15540
Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16609

我什至尝试过 dnvm upgrade,将 dnx 升级为 dnx-clr-win-x86.1.0.0-rc1-update2,但仍然出现错误。

我尝试了

中列出的大多数解决方案

An error occurred attempting to determine the process id of the DNX process hosting your application

An error occurred attempting to determine the process id of the DNX process hosting your application on clean installed windows 10 + vs2015

他们都没有工作。

这是一个简单的测试应用程序,如果有人想看的话。 https://github.com/vinodbadugu/aspnet5test

launchsettings.json(更新 1

    {
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:44342/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "http://localhost:44342/",
      "environmentVariables": {
        "Hosting:Environment": "Development"
      },
      "sdkVersion": "dnx-clr-win-x86.1.0.0-rc1-update2"
    },
    "web": {
      "commandName": "web",
      "environmentVariables": {
        "Hosting:Environment": "Development"
      }
    }
  }
}

项目.json

{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics":  "1.0.0-rc1-final"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ]
}

startup.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;

namespace Tutorial1
{
    public class Startup
    {
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            app.UseIISPlatformHandler();
            app.UseDeveloperExceptionPage();

            app.Run(async (context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });
        }

        // Entry point for the application.
        public static void Main(string[] args) => WebApplication.Run<Startup>(args);
    }
}

dnvm 列表

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

【问题讨论】:

  • 您是否以管理员身份运行 VS?
  • 是的,我也尝试了该选项,但没有运气
  • 你的dnvm list 输出显示了什么?
  • 我用 dnvm list 编辑了我的帖子
  • 看起来这是一个未解决的问题。 github.com/aspnet/Home/issues/1194

标签: c# visual-studio-2015 dnx asp.net5


【解决方案1】:

我在 IISExpress 中运行调试时遇到了同样的问题。同样在 Windows 10 上。总是收到“尝试确定托管应用程序的 DNX 进程的进程 ID 时发生错误”。即使对于没有更改和身份验证的新 Web 应用程序也是如此。尝试了上面 Vinod 列出的所有 StackOverflow 解决方案。

对我有用的是安装“Microsoft ASP.NET 和 Web 工具”的最新更新(版本 14.1.20512.0 - 日期为 2016 年 5 月 18 日 - https://visualstudiogallery.msdn.microsoft.com/c94a02e9-f2e9-4bad-a952-a63a967e3935)。在我尝试了几乎所有东西后的第二天,更新就真的出来了。它甚至可以在启用 Windows 身份验证的情况下调试 IISExpress 上的应用程序。

希望这会有所帮助。

【讨论】:

  • 我今天早上也下载了更新。那个特殊的错误消失了,但又遇到了另一个障碍。收到错误“启动 Web 服务器的时间比预期的要长”。打算做一些研究来弄清楚发生了什么。
  • @Vinod,与 DNX 问题无关,但一个月前我已将 IISexpress 降级到版本 8(而不是版本 10)。那时,我很难让 IISExpress 10 启动另一个项目。升级回 IISExpress 10 并没有解决 DNX 问题,所以我再次降级回版本 8。也许你可以试试降级。
【解决方案2】:

请编辑您的launchsettings.json 重新启动 VS 并尝试再次调试。

{
  ...
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "Hosting:Environment": "Development"
      },
      "sdkVersion": "dnx-clr-win-x86.1.0.0-rc1-update2"
    },
    ...
}

【讨论】:

  • 我更新了 lauchsettings.json。得到同样的错误。我什至重新启动计算机并以管理员身份打开 VS。我还验证以确保 Visual Studio 正在从 launchsettings.json 中获取更改,并且项目属性窗口显示使用特定版本:1.0.0-rc1-update2。得到同样的错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-11-13
  • 2021-02-10
  • 1970-01-01
  • 2017-09-03
  • 2019-05-13
  • 2016-06-28
  • 1970-01-01
相关资源
最近更新 更多