gpt4 book ai didi

azure - 在 Azure 上的应用服务 (.NET 6) 中运行 WCF(核心 WCF)服务

转载 作者:行者123 更新时间:2023-12-03 03:22:43 25 4
gpt4 key购买 nike

我们非常高兴看到 CoreWCF 项目进展顺利。现在,我们正在尝试使用 .NET 6 将在 CoreWCF 中编写的 WCF 服务部署到 Azure 应用服务。部署成功,但 WCF 端点不起作用。

您能否告诉我目前是否支持此功能?如果是,您有如何操作的说明吗?

非常感谢您,非常感谢您的工作!

艾伦

最佳答案

Azure App Service does not support NetTcpBinding. Run WCF (Core WCF) service in App Service (.NET 6) on Azure

可以将 corewcf 中的 WCF 服务部署到 Azure 应用服务 (Net 6)。

根据 Azure App Service operating system functionality documentation ,Azure 应用服务支持命名管道作为共同运行应用程序的不同进程之间的进程间通信 (IPC) 机制。

在 WCF 服务中使用命名管道而不是 NetTcpBinding

corewcf 中的 WCF 服务部署到 Azure 应用服务 (Net 6)

的步骤
  1. 在 Visual Studio 中创建一个新的 ASP.NET Core Web 应用程序项目。并使用 corewcf 模板向项目添加 WCF 服务。

enter image description here

  • 并更新 appsettings.json 文件,如下所示。
  • {
    "AllowedHosts": "*",
    "Wcf": {
    "Endpoints": {
    "Http": {
    "Url": "http://localhost:4000/MyService"
    }
    }
    }
    }

  • 使用以下代码更新 Startup.cs 文件:
  • public void ConfigureServices(IServiceCollection services)
    {
    services.AddWcf();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
    app.UseRouting();

    app.UseEndpoints(endpoints =>
    {
    endpoints.MapWcfService<MyService>();
    });
    }

  • 将项目发布到 Azure,在 Azure 门户中转到“配置”选项卡,然后添加键为“WEBSITE_LOAD_USER_PROFILE”和值“1”的应用程序设置。并重新启动应用服务。
  • 有关更多信息,请参阅MSDocMSDoc.

    关于azure - 在 Azure 上的应用服务 (.NET 6) 中运行 WCF(核心 WCF)服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76552356/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com