当我通过Visual Studio 2017(15.7.3)开始调试时,为什么要创建IIS 10应用程序池?

问题描述 投票:7回答:1

编辑1:我使用相同的配置遇到与ASP NET Core 2.0应用程序相同的问题,因此这本身排除了框架。下一个潜在的罪魁祸首:.NET Core 2.1 SDK(v2.1.300)或糟糕的Visual Studio更新(15.7.3)。


我调试API时,IIS 10和ASP NET Core 2.1.0有一个奇怪的问题。

我有一个IIS网站“api.local”,里面有一个ASP NET Core 2.0应用程序“v1”。

“v1”应用程序配置为使用我创建网站时生成的“api.local”应用程序池。此应用程序池配置如下:

  • .Net CLR版本:无托管代码
  • 管理管道模式:集成
  • 身份:ApplicationPoolIdentity

为了在Visual Studio 2017(15.7.3)中进行调试,我使用以下launchSettings.json

{
    "iisSettings": {
        "windowsAuthentication": false,
        "anonymousAuthentication": true,
        "iis": {
            "applicationUrl": "https://api.local/v1",
            "sslPort": 0
        }
    },
    "profiles": {
        "IIS": {
            "commandName": "IIS",
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            },
            "launchBrowser": true,
            "launchUrl": "graphiql/"
        }
   } 
}

一切都很好。


现在,每次我开始调试时,都会创建一个名为“v1 AppPool”(然后是“v1 AppPool 2”等)的新IIS应用程序池,并且“v1”网站配置将更改为使用此新创建的IIS Applicataion池。

我不知道从什么时候开始,但我认为在将以下nuget软件包更新到2.1.0版本之后就开始了:

<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />

作为参考,这是我的WebHostBuilder初始化:

public static IWebHost BuildWebHost(string[] args) =>
       new WebHostBuilder()
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .ConfigureLogging((hostingContext, logging) =>
            {
                if (hostingContext.HostingEnvironment.IsDevelopment())
                {
                    logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
                    logging.AddConsole();
                    logging.AddDebug();
                }
            })
            .UseIISIntegration()
            .UseDefaultServiceProvider((context, options) =>
            {
                options.ValidateScopes = context.HostingEnvironment.IsDevelopment();
            })
            .UseStartup<Startup>()
            .Build();

有没有人知道我能做些什么来解决这个问题?

iis asp.net-core visual-studio-2017 application-pool asp.net-core-2.1
1个回答
2
投票

我没有一个很好的答案。我遇到的问题和你描述的一样。我将我的VS更新到15.8.1并且问题停止了。所以我认为问题出在VS.

© www.soinside.com 2019 - 2024. All rights reserved.