使用不同的绑定托管服务的多个实例 [英] Hosting multiple instances of your service with different bindings

查看:51
本文介绍了使用不同的绑定托管服务的多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的WCF Demo编写一个控制台主机。 ServiceHost对象的设置在app.config的System.ServiceModel配置部分中指定。



目标

托管我的服务有两组不同的配置。例如,http:// localhost:8080处的ServiceHost实例1将是不安全的,而

http:// localhost:8081处的ServiceHost实例2将通过证书保护。



问题



配置文件中的服务元素需要Service类的全名,以便代码中的ServiceHost实例可以读取配置值。



有没有办法通过配置为同一服务指定两组服务元素?



我可能(需要测试)可以通过在代码中自己构建WCF对象模型或者使用不同配置运行的控制台应用程序的两个不同实例来实现这一点。

解决方案

Hi, I'm trying write a console host for my WCF Demo. The settings for the ServiceHost object are specified in System.ServiceModel configuration section in app.config.

Goal
Have my "Service" hosted with two different set of configurations. For example, ServiceHost instance 1 at http://localhost:8080 will be unsecured, while ServiceHost instance 2 at
http://localhost:8081 will be secured through certs.

Issue

The service element in config file requires the full name of your Service class so that ServiceHost instance in code can read the configuration values.

Is there a way to specify to two sets of service element for the same service through configuration?

I can probably (needs to test) can achieve this by building the WCF object model myself in the code or have two different instances of the console app running with different configurations.

解决方案

这篇关于使用不同的绑定托管服务的多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆