在单个web.config中绑定多个wcf服务(svc)

编程入门 行业动态 更新时间:2024-10-27 07:29:24
本文介绍了在单个web.config中绑定多个wcf服务(svc)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我遇到了在单个web.config中绑定多个svc文件的问题 i希望在单个web.config中绑定两个svc文件 我的代码:

< 绑定 > < ; webHttpBinding > < binding name = webHttpBindingWithJsonP crossDomainScriptAccessEnabled = true > < / binding > < / webHttpBinding > < / bindings > < 服务 > < service name = WcfService.ListRequest behaviorConfiguration = ListRequestBehaviour > < endpoint 地址 = 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 > < / endpoint > < / service > < service 名称 = WcfService .Service1 behaviorConfiguration = Service1Behavior > < endpoint 地址 = binding = webHttpBinding 合同 = HotelWcfService.IService1 behaviorConfiguration = web > < / endpoint > < / service > < ; / services > < 行为 姓名 = ListRequestBehaviour > < serviceMetadata httpGetEnabled = true / > < serviceDebug includeExceptionDetailInFaults = false / > < / behavior > < 行为 name = Service1Behavior > < serviceMetadata httpGetEnabled = true / > < serviceDebug includeExceptionDetailInFaults = false / > < / behavior >

我把它们放在一起,它对我有用......

通过这个链接你会得到一些想法, stackoverflow/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, stackoverflow/questions/2584680/wcf-define-multiple-services-in-a-single-app-config-file Regards, BlueSathish

更多推荐

在单个web.config中绑定多个wcf服务(svc)

本文发布于:2023-11-07 09:06:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566055.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   绑定   config   web   wcf

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!