【发布时间】:2023-03-05 10:56:01
【问题描述】:
我想为我创建的 Web 服务启用 WSDL 检索。我可以通过我制作的 .svc 文件“调用”网络服务:
http://localhost/test.svc
<%@ ServiceHost Language="C#" Debug="true" Service="Project.MyService" CodeBehind="MyService.svc.cs" %>
调用该页面会给出标准的 .NET 消息,指出“此服务的元数据发布当前已禁用”。带有启用发布的说明。
我按照说明添加了 web.config 条目,但是调用 http://localhost/test.svc?wsdl 会产生相同的结果...如何为我的 web 服务启用 WSDL 发布?
web.config 条目
<service name="Project.IMyService" behaviorConfiguration="MyServiceTypeBehaviors" >
<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="mex"
/>
<host>
<baseAddresses>
<add baseAddress="http://localhost/test.svc"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
【问题讨论】:
标签: wcf configuration wsdl