简体   繁体   English

WCF,wsHttpBinding和wsp:policy

[英]WCF, wsHttpBinding and wsp:policy

I'm using .NET 4.0, WCF and wshttp binding to create some ws methods. 我正在使用.NET 4.0,WCF和wshttp绑定来创建一些ws方法。 Reason for using wsHttp binding is that I need support for auth., encryption and signing. 使用wsHttp绑定的原因是我需要对身份验证,加密和签名的支持。

When I create such a service and look into wsdl, I see there is wsp:policy tag there. 创建此类服务并查看wsdl时,我看到那里有wsp:policy标记。 Is there a way to somehow influence WCF configuration and remove this tag? 有没有办法以某种方式影响WCF配置并删除此标记?

As I understand it is possible to have encryption and signing without this tag. 据我所知,可以在没有此标记的情况下进行加密和签名。

You can replace generated WSDL by your own WSDL ( serviceMetadata - externalMetadataLocation). 您可以用自己的WSDL( serviceMetadata -externalMetadataLocation)替换生成的WSDL。 This is the only way where I'm sure you can achieve what you want because you will write WSDL from scratch. 这是我确定可以实现所需目标的唯一方法,因为您将从头开始编写WSDL。 There are extensibility points for modification of generated WSDL and policies - IWsdlExportExtension and IPolicyExportExtension but I think you will only be able to add new items to WSDL but not removing items added by API features (build-in security, etc.). 有用于修改生成的WSDL和策略的扩展点 - IWsdlExportExtensionIPolicyExportExtension但我认为您只能向WSDL添加新项,但不能删除API功能添加的项(内置安全性等)。

Btw. 顺便说一句。 IMHO it is very bad idea to remove policies because WSDL should describe the service and it should be the only description developer need to have to create client application. 恕我直言,删除策略是一个非常糟糕的主意,因为WSDL应该描述服务,并且它应该是开发人员创建客户端应用程序所需的唯一描述。 If you remove policies your WSDL will cover only partial information about your service and it will become useless. 如果删除策略,则WSDL将仅涵盖有关服务的部分信息,它将变得无用。 Definitely you will brake compatibility with proxy generation tools. 绝对可以制动与代理生成工具的兼容性。 I had related question about this topic. 我有关于这个主题的相关问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM