WCF元数据缺少操作
我有一个在Visual Studio中运行的简单Web服务。 如果我尝试查看元数据,则缺少有关操作的信息,因此svcutil会生成客户端代码,而无需任何方法。 我的设置有什么问题吗?
接口:
[System.ServiceModel.ServiceContractAttribute(Namespace="https://Test/Publish", ConfigurationName="IFCRPublish")] public interface IFCRPublish { // CODEGEN: Generating message contract since the operation PublishNotification is neither RPC nor document wrapped. [System.ServiceModel.OperationContractAttribute(Action="https://Test/PublishNotification", ReplyAction="*")] PublishNotificationResponse1 PublishNotification(PublishNotificationRequest1 request); }
响应:
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class PublishNotificationResponse1 { [System.ServiceModel.MessageBodyMemberAttribute(Namespace="https://Test/PublishTypes", Order=0)] public PublishNotificationResponse PublishNotificationResponse; public PublishNotificationResponse1() { } public PublishNotificationResponse1(PublishNotificationResponse PublishNotificationResponse) { this.PublishNotificationResponse = PublishNotificationResponse; } }
请求:
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class PublishNotificationRequest1 { [System.ServiceModel.MessageBodyMemberAttribute(Namespace="https://Test/PublishTypes", Order=0)] public PublishNotification PublishNotification; public PublishNotificationRequest1() { } public PublishNotificationRequest1(PublishNotification PublishNotification) { this.PublishNotification = PublishNotification; } }
这是我收到的元数据:
我的手术去了哪里?
解决了它。 为OperationContract设置ReplyAction =“*”表示WsdlExporter(发布元数据)将忽略该操作。 设置任何其他值可以修复它。
令我困扰的是,svcutil默认将replyaction设置为*,这意味着默认情况下svcutil会创建有效破坏元数据的服务。
尝试从你的enpoint的地址删除FCRPublish
…你的mex端点在那里似乎没问题,所以我相信它应该工作
上述就是C#学习教程:WCF元数据缺少操作分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/1015808.html