【问题标题】:asp .net core wcf endpointsasp .net 核心 wcf 端点
【发布时间】:2018-10-17 13:20:35
【问题描述】:

我正在开发一个调用 WSDL soap api 的小型 Web API。 WSDL 文件有一个端点集,但我希望能够在 appsetting.json 文件中更改它,这样我就可以为不同的环境(DEV、生产等)设置不同的端点。我知道在传统的 .NET 中你可以设置web.config 文件中的端点,所以我尝试在 appsettings.json 中模拟它

 "client": {
   "endpoint": {
   "address": "https://testaddress.com:9000",
   "binding": "basicHttpBinding",
   "bindingConfiguration": "MyWSDLService_Binder",
   "contract": "MyWSDLNamespace.Service__PortType",
   "name": "MyWSDLService_Port"
 }
}

我将bindingConfiguration 设置为实际WSDL 中节点<wsdl:binding> 中的name 属性,并将contract 设置为同一节点的type,前面标注了WCF 点的命名空间。 name: 我设置为<wsdl:port> 节点的name 属性。本质上,我希望能够在 appsettings.json 文件中设置<soap:address location>

【问题讨论】:

    标签: c# wcf asp.net-core configuration wsdl


    【解决方案1】:

    基于此link,在 ASP.NET Core 中,尚无法在单独的配置文件中进行配置。它只是通过代码设置的。

    不幸的是,您暂时必须坚持使用代码。

    【讨论】:

      猜你喜欢
      • 2020-04-25
      • 2017-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-14
      相关资源
      最近更新 更多