asp.net – WCF:如何将多个服务组合到单个WSDL中
发布时间:2020-12-16 09:25:03 所属栏目:asp.Net 来源:网络整理
导读:在我的ASP.NET WebForms项目中,我引用了WCF服务库项目,该项目包含每个业务对象的不同WCF服务.这些服务托管在IIS中,可以通过我在Global.asax中定义的路由获取WSDL:一个WSDL通过一条路由为每个服务. 我真正需要的是 – 一些选择服务的能力,我想为不同的客户提
在我的ASP.NET WebForms项目中,我引用了WCF服务库项目,该项目包含每个业务对象的不同WCF服务.这些服务托管在IIS中,可以通过我在Global.asax中定义的路由获取WSDL:一个WSDL通过一条路由为每个服务.
我真正需要的是 – 一些选择服务的能力,我想为不同的客户提供服务,并为所选服务集生成一个单一的WSDL. 解决方法
是的,可以配置WCF路由服务并获取WSDL文件,从而形成单独的服务.
步骤1 – 将HttpGetEnabled设置为true并在路由器服务后面的所有WCF服务中配置MEX端点 <service behaviorConfiguration="routingBehv" name="System.ServiceModel.Routing.RoutingService"> <host> <baseAddresses> <add baseAddress="http://localhost/WcfRoutingService/RoutingService.svc"/> </baseAddresses> </host> <endpoint address="http://localhost/WcfRoutingService/RoutingService.svc" binding="mexHttpBinding" name="mexEndpoint" contract="System.ServiceModel.Routing.IRequestReplyRouter"/> </service> 步骤2-配置路由服务 添加端点 <endpoint address="" binding="mexHttpBinding" name="mexEndpoint" contract="System.ServiceModel.Routing.IRequestReplyRouter"/> 添加服务行为 <behaviors> <serviceBehaviors> <behavior> <routing routeOnHeadersOnly="false" filterTableName="routingTable" /> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceMetadata httpGetEnabled="false" /> </behavior> </serviceBehaviors> </behaviors> 客户端端点地址应指定“MEX”端点地址 <client> <endpoint address="http://localhost/PremiumWcfService/PremiumWCFService.svc/mex" binding="mexHttpBinding" contract="*" name="PremiumServiceMex"/> <endpoint address="http://localhost/StandardWCFService/StandardWCFService.svc/mex" binding="mexHttpBinding" contract="*" name="StandardServiceMex"/> </client> 指定路由表 <routing> <filters> <filter name="StandardServiceMexFilter" filterType="EndpointAddress" filterData="http://tempuri.org/WcfRoutingService/RoutingService.svc/StandardService" /> <filter name="PremiumServiceMexFilter" filterType="EndpointAddress" filterData="http://tempuri.org/WcfRoutingService/RoutingService.svc/sPreminuService" /> </filters> <filterTables> <filterTable name="routingTable"> <add filterName="StandardServiceMexFilter" endpointName="StandardServiceMex"/> <add filterName="PremiumServiceMexFilter" endpointName="PremiumServiceMex"/> </filterTable> </filterTables> </routing> 你们都完成了. http://localhost/WcfRoutingService/RoutingService.svc/StandardService http://localhost/WcfRoutingService/RoutingService.svc/PremiumService (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- VS 2015 CTP 6 Nuget Package Source
- asp.net-mvc – MVCGrid.Net排序问题 – sortdirection
- 如何在页面视图或按钮单击之间增加ASP.NET(C#)中的变量
- asp.net – 如何加密web.config中的一个条目
- asp.net – WCF,WebAPI和OWIN IIS集成管道.根据路线跳过OWI
- asp.net-core – 无法从Client访问IdentityServer4 doc示例
- asp.net-mvc – “后退”按钮和防伪令牌
- asp.net-mvc – Azure上的MVC4部署问题
- 只有内容控件才能直接在包含ASP.NET内容控件的内容页面中
- 在Asp.NET中黑客会话变量
推荐文章
站长推荐
- asp.net-mvc-3 – .NET MVC 3自定义十进制?模型
- asp.net-mvc – ASP.Net MVC TempData – 如何保
- ASP.NET Webforms ASP.NET Ajax与ASP.NET MVC和A
- 在当前的HTTPContext中生成一个新的ASP.NET会话
- asp.net-mvc – mvc ActionLink中的RouteValueDi
- 为什么我的客户端去服务器来检查在使用ASP.NET M
- asp.net – 有一个很好的web.config编辑器吗?
- asp.net-mvc – 用于MVC的程序集中的资源的Bundl
- 如何使用MSBuild发布Asp.NET Web应用程序?
- asp.net-mvc – 将数据动态绑定到asp.net mvc中的
热点阅读