【发布时间】:2011-11-13 07:02:33
【问题描述】:
我的 wcf 服务库中有这个 App.config:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="addr" value="net.tcp://localhost:22222/AdministrationService/"/>
</appSettings>
<system.serviceModel>
<services>
<service name="Watchman.WcfService.AdministrationService" behaviorConfiguration="MyBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:22222/AdministrationService/"/>
</baseAddresses>
</host>
<endpoint name="Ep1" address="net.tcp://localhost/AdministrationService/" binding="netTcpBinding" bindingConfiguration="DuplexBinding" contract="Watchman.WcfService.Interfaces.IAdministration"/>
<endpoint name="mex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior">
<serviceThrottling maxConcurrentSessions="10000"/>
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost/AdministrationService/Ep1/wsdl"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="DuplexBinding" sendTimeout="00:00:01">
<reliableSession enabled="true"/>
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
但我得到了错误:
"The Address property on ChannelFactory.Endpoint was null. The ChannelFactory's Endpoint must have a valid Address specified."
似乎应用程序没有这个 tcp.net 端点。为什么?
【问题讨论】:
-
您是否在客户端中指定了端点地址?
-
@Reniuz 我使用 svcutil 在客户端生成 app.config ......但我只是注意到我得到了“
" 而不是我的 net.tcp 端点。为什么? -
我不是 100% 确定,但也许您需要在 serviceBehaviors 中添加
<behavior name="metadataSupport">
标签: c# .net-4.0 wcf wcf-endpoint