我有两个应用程序。一个是托管 wcf 服务的 winform 服务器端,另一个是 winform 客户端应用程序,我必须在其中添加服务引用。没有任何 svc 文件。所以当我试图在winform wcf客户端创建服务代理时,只需输入像这样的url
http://localhost:7998/WPFHost/ 或 net.tcp://localhost:7997/WPFHost/通过服务引用添加服务然后报错。 元数据包含无法解析的引用:“net.tcp://localhost:7997/WPFHost/”。
在这里,我粘贴了托管 wcf 的 wcf 服务器端的完整 app.config 文件数据。请指导我添加服务参考无法添加的 app.config 中有什么问题。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="WCFService.Service"
behaviorConfiguration="behaviorConfig">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:7997/WPFHost/"/>
<add baseAddress="http://localhost:7998/WPFHost/"/>
</baseAddresses>
</host>
<endpoint address="tcp"
binding="netTcpBinding"
bindingConfiguration="tcpBinding"
contract="ServiceAssembly.IChat"/>
<endpoint address="net.tcp://localhost:7996/WPFHost/mex"
binding="mexTcpBinding"
contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="behaviorConfig">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="tcpBinding"
maxBufferSize="67108864"
maxReceivedMessageSize="67108864"
maxBufferPoolSize="67108864"
transferMode="Buffered"
closeTimeout="00:00:10"
openTimeout="00:00:10"
receiveTimeout="00:20:00"
sendTimeout="00:01:00"
maxConnections="100">
<security mode="None">
</security>
<readerQuotas maxArrayLength="67108864"
maxBytesPerRead="67108864"
maxStringContentLength="67108864"/>
<reliableSession enabled="true" inactivityTimeout="00:20:00"/>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>