我收到以下错误,我不确定我做错了什么。有人看到任何明显的东西吗?下面是我的项目的Web.config和我的WCF类库的App.config
地址属性 ChannelFactory.Endpoint为null。该 ChannelFactory的端点必须有一个 指定有效地址。
APP.CONFIG ON SERVER(在我的课堂图书馆)
<system.serviceModel>
<services>
<service behaviorConfiguration="Default" name="Trezoro.WebAPI.Trade.TradeService">
<endpoint address="" behaviorConfiguration="WebEPBehavior" binding="webHttpBinding"
contract="ITradeService" name="WebHttpBinding_ITradeService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/tradeservice/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="Default" name="Trezoro.WebAPI.Authentication.AuthService">
<endpoint address="" behaviorConfiguration="WebEPBehavior" binding="webHttpBinding"
contract="IAuthService" name="WebHttpBinding_IAuthService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8081/authservice" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="WebEPBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Default">
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
WEB.CONFIG在WEB项目中
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<bindings>
<customBinding>
<binding name="WebHttpBinding_IAuthService">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
</binding>
<binding name="WebHttpBinding_ITradeService">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
</binding>
</customBinding>
</bindings>
<client>
<endpoint binding="customBinding" bindingConfiguration="WebHttpBinding_IAuthService"
contract="IAuthService" name="WebHttpBinding_IAuthService" />
<endpoint binding="customBinding" bindingConfiguration="WebHttpBinding_ITradeService"
contract="ITradeService" name="WebHttpBinding_ITradeService" />
</client>
</system.serviceModel>
答案 0 :(得分:10)
您的客户端端点缺少一个地址。
答案 1 :(得分:4)
只需在客户端添加端点标记的地址属性(消费结束)。