gpt4 book ai didi

WCF 元数据不起作用

转载 作者:行者123 更新时间:2023-12-04 17:14:10 25 4
gpt4 key购买 nike

我曾多次尝试让我的 WCF 服务公开 MetaData。相反,我一直保留异常(exception):

The contract name 'IMetadataExchange' could not be found in the list of contracts implemented by the service SecurityBroker. Add a ServiceMetadataBehavior to the configuration file or to the ServiceHost directly to enable support for this contract.



... 使用 IE 手动浏览服务时。

(我认为这与我的客户端应用程序无法生成服务引用的原因相同。婴儿步骤等等)

然而我的 web.config 看起来还不错:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<behaviors>
<endpointBehaviors>
<behavior name="webHttpEnablingBehaviour">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webHttpEnablingBehaviour">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="IWW.MIGTurbo2.WCF.Security.SecurityBroker">
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration="default"
contract="IWW.MIGTurbo2.WCF.Security.ISecurityBroker"
behaviorConfiguration="webHttpEnablingBehaviour">
</endpoint>
</service>
</services>
<client />
<bindings>
<webHttpBinding>
<binding name="default" />
</webHttpBinding>
</bindings>
</system.serviceModel>

所以我有我的 IMetadataExchange 契约(Contract)定义为 墨西哥 很好,就我所见,连接起来了。我错过了一些愚蠢的东西吗?

编辑

我的服务定义如下所示,如果这有用的话:
<%@ ServiceHost Language="C#" Debug="true" Service="IWW.MIGTurbo2.WCF.Security.SecurityBroker" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory"   %>

最佳答案

您的配置文件在“端点”元素上具有行为配置属性,但在“服务”元素上也需要它。

关于WCF 元数据不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/876858/

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