C# WCF元数据调用不工作
我使用windows身份验证在localhost中发布了我的WCF。我正在使用wcftestclient进行测试 我正在尝试获取元数据。无论我如何尝试浏览tools.svc/$metadata,我都会遇到错误的请求错误 下面是我的web.configC# WCF元数据调用不工作,c#,wcf,C#,Wcf,我使用windows身份验证在localhost中发布了我的WCF。我正在使用wcftestclient进行测试 我正在尝试获取元数据。无论我如何尝试浏览tools.svc/$metadata,我都会遇到错误的请求错误 下面是我的web.config <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="defaultBehavior"> &
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="defaultBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<behavior name="mexBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="MyBasicHttpBindingSoap" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="mexBehaviour" name="Tools_ws.Tools_Service">
<endpoint binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBindingSoap"
name="ToolsServiceEndPoint" contract="Tools_ws.ITools_ws" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
错误消息是
错误:无法从/Tooals.svc/$元数据中获取元数据,如果这是您可以访问的Windows(R)通信基础服务,请检查您是否已在指定地址启用元数据发布。有关启用元数据发布的帮助,请参阅位于Exchange错误URI:/Tools的MSDN文档。svc/$metadata元数据包含无法解析的引用:'/Tools.svc/$metadata'。HTTP请求未经客户端身份验证方案“匿名”授权。从服务器接收的身份验证标头为“协商,NTLM”。远程服务器返回错误:(401)Unauthorized.HTTP GET error URI:/Tools.svc/$metadata下载“/Tools.svc/$metadata”时出错。请求失败,HTTP状态为400:请求错误
我提到了微软的链接和谷歌的许多其他链接,但无法做到这一点。非常感谢您的帮助您是否正在尝试获取OData元数据?或者仅仅是wsdl?尝试获取OData元数据已经有一段时间没有使用WCF了,但是使用mex端点行为的basicHttpBinding对于OData支持似乎不正确。难道没有其他支持OData的“web”绑定吗?(抱歉,我自己使用WebAPI来做OData,而不是WCF)WebHttpBinding(以及更多)请参见