gpt4 book ai didi

c# - WCF 服务中缺少元数据

转载 作者:太空宇宙 更新时间:2023-11-03 13:24:39 26 4
gpt4 key购买 nike

我遇到了一个问题,我的 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>

最佳答案

WCF REST 服务不使用元数据,它仅适用于 SOAP。尝试使用 fiddler或其他类似工具作为测试客户端

关于c# - WCF 服务中缺少元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22820451/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com