我知道如果 a 中的代码.dll想要读取其配置文件,则必须手动执行。但是,如果(在同一文件中.dll)您正在引用一项服务,那会如何搭建一些代码并将一些配置添加到.config文件中,因此我能够使用该服务的唯一方法是将该配置复制到主应用程序的.config文件中。
我想知道是否有人有另一种方法。我认为它应该使用脚手架提供的任何构造函数,但无法使其工作。
这些是构造函数:
MyServiceClient(string endpointConfigurationName)
MyServiceClient(string endpointConfigurationName, string remoteAddress)
MyServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress)
MyServiceClient(Binding binding, EndpointAddress remoteAddress)
和配置:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicEndPoint" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="<service-url>"
binding="basicHttpBinding" bindingConfiguration="BasicEndPoint"
contract="<contract>" name="BasicEndPoint" />
</client>
</system.serviceModel>
提前致谢!
跃然一笑
相关分类