我遇到了一个问题,WCF REST服务似乎没有元数据。这使我无法使用WCF测试客户端。
服务的其余部分似乎正确地构建和生成服务定义。这是我的web.config。我在这里错过了什么?如有任何建设性意见,将不胜感激。
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<connectionStrings>
<clear />
<add name="Requests" connectionString="REMOVED" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="Requests.Requests" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="webHttpBinding" contract="Requests.IRequests" bindingConfiguration="WebBinding" behaviorConfiguration="EndpointBehavior" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="WebBinding">
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="EndpointBehavior">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" automaticFormatSelectionEnabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>发布于 2014-04-02 19:37:10
WCF REST服务不使用元数据,它只适用于SOAP。尝试使用费德勒或其他类似工具作为测试客户端
发布于 2017-07-27 13:36:12
我也遇到了同样的问题--在我完全不知所措之前从未使用过WCF测试工具。
我发现卡洛斯·菲盖拉的以下回答非常有见地:
这是web编程模型本身的一个限制。与SOAP端点(即具有BasicHttpBinding、WSHttpBinding等的端点)不同的是,SOAP端点可以使用端点中所有操作/参数的信息来公开自身的元数据(WSDL或Mex),目前还没有标准的方法来公开非SOAP端点的元数据--这正是基于webHttpBinding的端点的特性。简而言之,WCF测试客户端对于基于web的端点并不有用。如果在WCF发布下一个版本时出现了一些表示web样式端点的标准,我们可能会更新测试客户端以支持它,但目前还没有被广泛采用。
在WCF测试客户端和WebHttpBinding阅读更多内容
https://stackoverflow.com/questions/22820451
复制相似问题