我已經創建了具有以下配置的服務主機。WCF IMetadataExchange錯誤
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="MathServiceLib.MathService" behaviorConfiguration="myMathServiceBehave">
<host>
<baseAddresses>
<add baseAddress="http://localhost:9001/MathService"/>
<add baseAddress="net.tcp://localhost:9002/MathService"/>
</baseAddresses>
</host>
<endpoint address="http://localhost:9001/MathService" binding="basicHttpBinding" contract="MathServiceLib.IMathService"/>
<endpoint address ="net.tcp://localhost:9002/MathService" binding ="netTcpBinding" contract="MathServiceLib.IMathService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<!--<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myMathServiceBehave">
<!--<serviceMetadata httpGetEnabled="true"/>-->
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我不想使用serviceMetadata httpGetEnabled =「真正的」屬性,而不是我想用MEX創建代理結合。現在
當我使用
svcHost = new ServiceHost(typeof(MathServiceLib.MathService));
svcHost.Open();
我獲得以下錯誤,請幫我啓動服務。
無法在由服務MathService實施的合同列表中找到合同名稱'IMetadataExchange'。將ServiceMetadataBehavior添加到配置文件或直接添加到ServiceHost以啓用對此合同的支持。
你有沒有impl評論'IMetadataExchange'接口(如你的端點定義)?或者你只是想引入另一種連接到IMathService的方式? 也許你錯過了'System.ServiceModel.Description'庫? –