c# - Windows Server 2008 R2 共同托管遗留 .Net 应用程序与 .Net Core 应用程序

标签 c# asp.net iis asp.net-core .net-4.0

我有一台运行 Windows Server 2008 R2 的服务器。它目前在 IIS 中运行多个 ASP.NET 4.5.2 应用程序。

我有一个新的 ASP.Net Core 应用程序,我想将其部署到同一台服务器上的 IIS。

  1. 这可能吗?
  2. 我需要做什么才能让它发挥作用?

在我的 .Net Core 应用程序中,我的主要方法中包含以下内容:

public static void Main(string[] args)
{
    var host = new WebHostBuilder()
        .UseKestrel()
        .UseContentRoot(Directory.GetCurrentDirectory())
        .UseIISIntegration()
        .UseStartup<Startup>()
        .UseStructureMap()
        .Build();

    host.Run();
}

我的 project.json 中还有以下内容

"Microsoft.NETCore.App": {
  "version": "1.1.0"
},
"runtimes": {
  "win7-x64": {}
}

我想确保我的 .Net Core 和遗留的 .Net Framework 应用程序不会相互冲突。

最佳答案

我能够按照本教程进行操作:https://learn.microsoft.com/en-us/aspnet/core/publishing/iis

关键是,当我在服务器上安装 .NET Core Windows Server 托管 bundle 时,我没有安装 .Net Core 运行时,因为我的 .Net Core 应用程序是独立的。我通过从命令行安装 Hosting Bundle 并使用以下命令来完成此操作

DotNetCore.1.0.3_1.1.0-WindowsHosting.exe OPT_INSTALL_LTS_REDIST=0 OPT_INSTALL_FTS_REDIST=0

关于c# - Windows Server 2008 R2 共同托管遗留 .Net 应用程序与 .Net Core 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42542711/

相关文章:

c# - 两个 Drives 中的两个 TreeView 结构

c# - WPF 包装面板中的 float 行为

.net - 将 misc 文件放在 bin 目录中是个坏主意

c# - 从 onchange 触发 .click() 时 IE9 出现 "SCRIPT5 Access is denied"错误

c# - CS1617 : Invalid option ‘6’ for/langversion; must be ISO-1, ISO-2、3、4、5 或默认

asp.net - 无法为网站禁用 SSL

c# - 链接到 C# GUI 的 C++ 程序

c# - Windows 8 CollectionViewSource ObservableCollection 绑定(bind)不更新

c# - 使用 Server.Transfer 传递参数但不使用查询字符串

c# - 如何检查输入的密码是否等于存储的密码?