asp .net 核心 wcf 端点
Posted
技术标签:
【中文标题】asp .net 核心 wcf 端点【英文标题】:asp .net core wcf endpoints 【发布时间】: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>
。
【问题讨论】:
【参考方案1】:基于此link,在 ASP.NET Core 中,尚无法在单独的配置文件中进行配置。它只是通过代码设置的。
不幸的是,您暂时必须坚持使用代码。
【讨论】:
以上是关于asp .net 核心 wcf 端点的主要内容,如果未能解决你的问题,请参考以下文章
ValidateAntiForgeryToken 端点属性在 Asp.Net 核心 Angular Web 应用程序中每次 CSRF 攻击的使用情况