开发者

Using 2 WCF interfaces in the same svc file

开发者 https://www.devze.com 2023-03-28 17:04 出处:网络
We are trying to communicate with an 开发者_Python百科external WCF service. The WCF services are exposed via svc files. It appears that there are 2 interfaces exposed via the same svc file.

We are trying to communicate with an 开发者_Python百科external WCF service.

The WCF services are exposed via svc files. It appears that there are 2 interfaces exposed via the same svc file.

How can we configure this in the web.config file?


If I understand your question correctly, you have a single class that implements 2 WCF service contracts. In your web.config, you configure an endpoint for each service contract, but under the same <service> node. I've only done this when self-hosting WCF services, not in IIS, but I think if you specify a value for address in your endpoint configuration, it will make it relative to the location of the .svc file:

<service name="YourServiceLibrary.YourServiceClass">
  <endpoint address="Service1"
    contract="YourServiceLibrary.IService1"
    ...
     />
  <endpoint address="Service2"
    contract="YourServiceLibrary.IService2"
    ...
     />
</service>

You would then setup your client proxies for each service contract to point to http://YourServer/YourServicePath/YourServiceClass.svc/Service1 and http://YourServer/YourServicePath/YourServiceClass.svc/Service2

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号