我有问题。我尝试使用多个entpoints构建WCF通信。但它永远不会工作,它会显示如下的ErrorMessage:
这是我的配置文件:
*
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="MwWcfLibrary.Service">
<endpoint address="net.tcp://localhost:8733"
binding="netTcpBinding"
bindingConfiguration=""
bindingName="Action"
name="ActionInterface"
contract="MwWcfLibrary.Actions.Interfaces.IAction">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex"
binding="mexTcpBinding"
bindingConfiguration=""
name="Mex"
contract="IMetadataExchange" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint binding="netTcpBinding"
address="net.tcp://localhost:8733"
bindingConfiguration=""
name="LifeSignInterface"
bindingName="LifeSign"
contract="MwWcfLibrary.LifeSign.Interfaces.ILifeSign" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint binding="netTcpBinding"
address="net.tcp://localhost:8733"
bindingConfiguration=""
name="DataInterface"
bindingName="Data"
contract="MwWcfLibrary.Notification.Interfaces.IData">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint binding="netTcpBinding"
address="net.tcp://localhost:8733"
bindingConfiguration=""
name="PublicDataInterface"
bindingName="PublicData"
contract="MwWcfLibrary.PublicData.Interfaces.IPublicData" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint binding="netTcpBinding"
address="net.tcp://localhost:8733"
bindingConfiguration=""
name="PublicStateInterface"
bindingName="PublicState"
contract="MwWcfLibrary.PublicState.Interfaces.IPublicState" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8733//MwWcfLibrary" />
</baseAddresses>
<timeouts closeTimeout="00:00:30" />
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
*
有人知道我配置错了吗?
亲切的问候。
答案 0 :(得分:0)
修改强>
您要么没有实现以下其中一个接口:
MwWcfLibrary.Actions.Interfaces.IAction
,MwWcfLibrary.LifeSign.Interfaces.ILifeSign
,MwWcfLibrary.PublicData.Interfaces.IPublicData
和MwWcfLibrary.PublicState.Interfaces.IPublicState
或其中一个或多个未使用[ServiceContract]
属性
在问题中包含实际错误而不是“{0}”,您会看到某些合同尚未由类Service
实现,这应该是这样的(至少):< / p>
class Service : IAction, ILifeSign, IPublicData, IPublicState
{
// implementation
}
此外,您的地址属性似乎不正确,因为您已经定义了以段// Mww结尾的基址...但在您的端点中,地址短于基址。端点地址可以像"Service"
一样相对。
<强>以前强>
Service
元素指的是一个ServiceContract
接口实现的类,它是endpoint
契约属性的内容。验证这些属性中接口和类的完全限定名称。
从查看配置文件,您说类MwWcfLibrary.Service
实现了名为[ServiceContract]
,MwWcfLibrary.Actions.Interfaces.IAction
,MwWcfLibrary.LifeSign.Interfaces.ILifeSign
的{{1}}装饰的)接口和MwWcfLibrary.PublicData.Interfaces.IPublicData
这似乎是错误的。你的意思是有两个服务,每个服务都有一个单独的端点?