WCF 4 服务的平面 WSDL [英] Flat WSDL for WCF 4 Service

查看:25
本文介绍了WCF 4 服务的平面 WSDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 WCF 3.5 和 FlatWsdl来自 Christian Weyer 的 EndpointBehavior,我能够为我的 WCF 服务获得一个单一的平面 WSDL 文件,而无需任何 指令.

Using WCF 3.5 and the FlatWsdl EndpointBehavior from Christian Weyer, I was able to get a single flat WSDL file for my WCF services without any <import> directives.

现在使用 WCF 4,由于某种原因这不再起作用.

Now with WCF 4, this doesn't work anymore for some reason.

我尝试了很多博客条目中描述的所有内容,包括使用 WcfExtras 行为扩展.

I have tried everything described in a lot of blog entries including using the WcfExtras behavior extension.

它们要么都指 Chr.Weyers 解决方案或推荐 WcfExtras.我还确保为绑定、ServiceContract 和 ServiceBehavior 指定了相同的命名空间.

They all either refer to Chr. Weyers solution or recommend the WcfExtras. I also made sure I specified the same namespace for the binding, ServiceContract and ServiceBehavior.

在自定义服务宿主中,当FlatWsdlExtension即将被注入时,Description.Endpoints集合始终为空.我尝试使用或不使用地址来配置我的服务端点,但到目前为止都没有运气.

In the custom service host, when the FlatWsdlExtension is about to be injected, the Description.Endpoints collection is always empty. I tried to configure my service endpoint with or without an adress, so far without luck.

我需要做什么才能为我的 WCF 4 服务获得一个单一的平面 WSDL?

What do I need to do in order to get a single flat WSDL for my WCF 4 service?

感谢您的回答.

推荐答案

我遇到了这个确切的问题.经过今天的多次尝试,我终于通过执行以下操作使其正常工作:

I was having this exact problem. After several attempts today, I finally got it to work by doing the following:

阅读这篇博文满了.

确保在以下内容中指定完全相同的命名空间属性:ServiceContract、ServiceBehavior 和 bindingNamespace(.config->services/service/endpoint 部分).

Make sure you specify exactly the same namespace attribute in: ServiceContract, ServiceBehavior, and bindingNamespace (.config->services/service/endpoint section).

注意这个问题,我曾经遇到过.

下载这个 zip 文件并包含 FlatWsdl/Extensions:FlatWsdl.cs、FlatWsdlServiceHost.cs 和 FlatWsdlServiceHostFactory.cs 位于项目中的某个位置.

Download this zip file and include FlatWsdl/Extensions: FlatWsdl.cs, FlatWsdlServiceHost.cs, and FlatWsdlServiceHostFactory.cs somewhere in your project.

确保在 .svc 文件的 ServiceHost Factory 属性中为您的 FlatWsdlServiceHostFactory.cs 版本(当然不包括 .cs)指定完全限定的类名.

Make sure you specify the fully-qualified classname for your version of FlatWsdlServiceHostFactory.cs (minus .cs of course) in the ServiceHost Factory attribute of your .svc file.

我今天尝试了 WcfExtras 和其他东西——它可能或多或少,但这些步骤终于让我开始了.祝你好运!

I tried WcfExtras among other things today -- there may be more or less to it, but these steps finally got me going. Good luck!

这篇关于WCF 4 服务的平面 WSDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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