在单个web.config中绑定多个wcf服务(svc) [英] Bind multiple wcf service (svc) in single web.config
本文介绍了在单个web.config中绑定多个wcf服务(svc)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了在单个web.config中绑定多个svc文件的问题
i希望在单个web.config中绑定两个svc文件
我的代码:
< 绑定 >
< ; webHttpBinding >
< binding name = webHttpBindingWithJsonP crossDomainScriptAccessEnabled = true > < / binding >
< / webHttpBinding >
< / bindings >
< 服务 >
< service name = WcfService.ListRequest < span class =code-attribute> behaviorConfiguration = ListRequestBehaviour >
< endpoint 地址 = < span class =code-attribute> binding = webHttpBinding 合同 = HotelWcfService.IListRequest behaviorConfiguration = web > < / endpoint >
< / service >
< / services >
<! - < services>
< service name =WcfService.Service1behaviorConfiguration =Service1Behavior>
< endpoint address =binding =webHttpBindingcontract =HotelWcfService.IService1behaviorConfiguration =web>< / endpoint>
< / service>
< / services> - >
< endpointBehaviors >
< behavior 名称 = web >
< webHttp defaultOutgoingResponseFormat = Xml automaticFormatSelectionEnabled = true / >
< / behavior >
< / endpointBehaviors >
< serviceBehaviors >
< 行为 名称 = ListRequestBehaviour > ;
< serviceMetadata httpGetEna bled = true / >
< serviceDebug includeExceptionDetailInFaults = false / >
< / behavior >
<! - < behavior name =Service1Behavior>
< serviceMetadata httpGetEnabled =true/>
< serviceDebug includeExceptionDetailInFaults =false/>
< / behavior> - >
< ; / serviceBehaviors >
< serviceHostingEnvironment aspNetCompatibilityEnabled = true multipleSiteBindingsEnabled = true / >
如果我评论并逐一运行,那么它的工作正常,但我希望它们能够同时运行。 />
请帮帮我。
解决方案
< services >
< service 名称 = WcfService.ListRequest behaviorConfiguration = ListRequestBehaviour >
< endpoint 地址 = 绑定 = webHttpBinding 合同 = HotelWcfService.IListRequest behaviorConfiguration = web < span class =code-keyword>> < / endpoint >
< / service < span class =code-keyword>>
< service 名称 = WcfService .Service1 behaviorConfiguration = Service1Behavior >
< endpoint 地址 = binding = webHttpBinding 合同 = < span class =code-keyword> HotelWcfService.IService1 behaviorConfiguration =跨度> <温泉n class =code-keyword> web > < / endpoint >
< < span class =code-leadattribute> / service >
< ; / services >
< 行为 姓名 = ListRequestBehaviour >
< serviceMetadata httpGetEnabled = true / >
< serviceDebug includeExceptionDetailInFaults = false / >
< / behavior >
< 行为 name = Service1Behavior >
< serviceMetadata httpGetEnabled = true / >
< serviceDebug includeExceptionDetailInFaults = false / >
< / behavior >
我把它们放在一起,它对我有用......
< blockquote>通过这个链接你会得到一些想法, http://stackoverflow.com/questions/2584680/wcf-define-multiple-services-in-a-single-app-config-file
问候,
BlueSathish
I m having a problem with binding multiple svc files in single web.config
i want to bind two svc files in single web.config
My code:
<bindings>
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true"></binding>
</webHttpBinding>
</bindings>
<services>
<service name="WcfService.ListRequest" behaviorConfiguration="ListRequestBehaviour">
<endpoint address="" binding="webHttpBinding" contract="HotelWcfService.IListRequest" behaviorConfiguration="web"></endpoint>
</service>
</services>
<!--<services>
<service name ="WcfService.Service1" behaviorConfiguration ="Service1Behavior">
<endpoint address="" binding="webHttpBinding" contract="HotelWcfService.IService1" behaviorConfiguration="web"></endpoint>
</service>
</services>-->
<endpointBehaviors>
<behavior name="web">
<webHttp defaultOutgoingResponseFormat="Xml" automaticFormatSelectionEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ListRequestBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<!--<behavior name="Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>-->
</serviceBehaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
if i comment and run one by one then its working fine but i want them to run symenteneously.
please help me.
解决方案
<services> <service name="WcfService.ListRequest" behaviorConfiguration="ListRequestBehaviour"> <endpoint address="" binding="webHttpBinding" contract="HotelWcfService.IListRequest" behaviorConfiguration="web"></endpoint> </service> <service name ="WcfService.Service1" behaviorConfiguration ="Service1Behavior"> <endpoint address="" binding="webHttpBinding" contract="HotelWcfService.IService1" behaviorConfiguration="web"></endpoint> </service> </services> <behavior name="ListRequestBehaviour"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> <behavior name="Service1Behavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior>
I put these togather and it worked for me...
Go through this link you'll get some idea, http://stackoverflow.com/questions/2584680/wcf-define-multiple-services-in-a-single-app-config-file
Regards,
BlueSathish
这篇关于在单个web.config中绑定多个wcf服务(svc)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文