我使用Windows身份验证在localhost中发布了我的WCF。我正在使用wcftestclient进行测试。
我正在尝试获取元数据。无论我如何尝试浏览到tools.svc / $ metadata,我都会收到错误的请求错误。
下面是我的web.config。
<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" />
错误信息是
错误:无法从/Tools.svc/$metadata获取元数据如果这是您有权访问的Windows(R)Communication Foundation服务,请检查您是否已在指定地址启用元数据发布。有关启用元数据发布的帮助,请参阅http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata上的MSDN文档Exchange错误URI:/Tools.svc/$metadata元数据包含无法解析的引用:&#39; /Tools.svc/$metadata 39 ;. HTTP请求未经授权使用客户端身份验证方案&#39; Anonymous&#39;。从服务器收到的身份验证标题是“Negotiate,NTLM&#39;”。远程服务器返回错误:(401)Unauthorized.HTTP GET错误URI:/Tools.svc/$metadata下载&#39; /Tools.svc/$metadata'时出错。请求失败,HTTP状态为400:错误请求。
我提到了微软链接和谷歌中的许多其他链接,但无法使其工作。任何帮助将不胜感激