【发布时间】: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