<system.serviceModel>
<services>
<service name="SUR.Core.Service.Implementation.SURDirectoryService" behaviorConfiguration="DefaultServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:8731/ISURDirectoryService"/>
</baseAddresses>
</host>
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultDirectoryServiceBindConfig" contract="SUR.Core.Service.Facade.ISURDirectoryService"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<service name="MSS.Core.Service.Implementation.MSSDirectoryService" behaviorConfiguration="DefaultServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:8731/IMSSDirectoryService" />
<add baseAddress="http://127.0.0.1:8732/IMSSDirectoryService" />
</baseAddresses>
</host>
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultDirectoryServiceBindConfig" contract="MSS.Core.Service.Facade.IMSSDirectoryService"/>
<endpoint address="Person" binding="basicHttpBinding" bindingConfiguration="StreamedServicesBinding" contract="MSS.Core.Service.Facade.IMSSPersonService"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<customBinding>
<binding name="MetadataExchangeTcpBinding">
<tcpTransport portSharingEnabled="True" />
</binding>
</customBinding>
<netTcpBinding>
<binding name="DefaultDirectoryServiceBindConfig" maxReceivedMessageSize="1048576"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00">
<security mode="None"></security>
</binding>
<binding name="mexBinding" portSharingEnabled="true">
<security mode="None"/>
</binding>
</netTcpBinding>
<basicHttpBinding>
<binding name="StreamedServicesBinding" transferMode="StreamedResponse" maxReceivedMessageSize="10067108864"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" maxBufferSize="500" >
<security mode="None"></security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata />
<dataContractSerializer maxItemsInObjectGraph="6553600" />
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<!--<serviceMetadata httpGetEnabled="True"/>-->
<serviceThrottling maxConcurrentCalls="30" maxConcurrentSessions="30" maxConcurrentInstances="30"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
这是我的WCF配置,但是当我尝试将服务引用添加到
时net.tcp://127.0.0.1:8731/IMSSDirectoryService
我收到错误:
元数据包含无法解析的引用:'net.tcp:// localhost:8731 / IMSSDirectoryService'。
如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。请帮我理解我的问题。
答案 0 :(得分:2)
您定义了两个相同的基址:
<service name="SUR.Core.Service.Implementation.SURDirectoryService"
behaviorConfiguration="DefaultServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:8731/ISURDirectoryService"/>
</baseAddresses>
<service name="MSS.Core.Service.Implementation.MSSDirectoryService"
behaviorConfiguration="DefaultServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:8731/IMSSDirectoryService" />
这是您遇到问题的原因 - 当连接到net.tcp://127.0.0.1:8731/
时,WCF不知道您的意思是哪种服务。
基本地址在其“架构”中必须是唯一的(例如http,net.tcp等)。
马克
编辑:如果您希望能够使用浏览器检索元数据并导航到URL以获取它,则需要在服务行为选项中激活<serviceMetadata httpGetEnabled="True"/>
。否则,您将只能通过net.tcp上的SOAP调用获取元数据 - 例如使用Visual Studio 9 / Common7 / IDE文件夹中的“WcfTestClient.exe”应用程序。
编辑2:您已为MEX定义了许多额外的绑定和行为,但由于您的所有mex端点都没有实际引用任何这些设置,因此它们未被使用。
答案 1 :(得分:0)
我解决了这个问题,我只是将MSS服务的mex绑定更改为http。非常感谢marc_s你的回复帮助我理解这个问题!