agA*_*Aus 12 meta wcf config wcf-binding endpoint
我知道这已被多次询问,并且多次回答,但是,所有提供的应该使用的样本似乎并不想今天为我工作.
当我尝试启动主机时,我不断收到以下错误:
"在服务TraceService实现的合同列表中找不到合同名称'IMetadataExchange'.将ServiceMetadataBehavior直接添加到配置文件或ServiceHost以支持此合同."
根据Microsoft的示例,我的服务托管在托管的Windows服务主机中:http://msdn.microsoft.com/en-us/library/ms733069%28v=vs.90%29.aspx
这是我的简单配置:
<system.serviceModel>
<services>
<service name="Daff.Lae.Service.TraceService">
<endpoint address="" binding="wsHttpBinding" name="TraceService" contract="Contracts.Service.ITraceService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/TraceService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
当然,如果删除此行,则没有错误时问题会变得更有趣:
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常非常感谢:)
Roc*_*oC5 25
请务必behaviorConfiguration在service配置元素中指定a 以允许其中任何一个httpGet或httpsGet.
我看到你已经定义了一个名为的serviceBehavior DefaultBehavior- 现在你需要做的就是添加behaviorConfiguration="DefaultBehavior"到service元素中,这样该行变为:
<service name="Daff.Lae.Service.TraceService" behaviorConfiguration="DefaultBehavior">
Run Code Online (Sandbox Code Playgroud)
如果未明确指定服务的行为,则默认情况下不允许HTTP GET和HTTPS GET,并且不会公开您的元数据.
| 归档时间: |
|
| 查看次数: |
22881 次 |
| 最近记录: |