我創建了一個用作WCF客戶端的控制檯應用程序。在app.config由以下部分組成:WCF錯誤:ChannelFactory.Endpoint上的地址屬性爲空
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="WebHttpBinding_IWebContentService">
<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 address="http://localhost:1252/SomeService.svc" binding="customBinding" bindingConfiguration="WebHttpBinding_IWebContentService"
contract="WebContentClient.IWebContentService" name="WebHttpBinding_IWebContentService" />
</client>
</system.serviceModel>
</configuration>
當我運行它,我得到以下錯誤:
The address property on ChannelFactory.Endpoint was null
端點元素有一個地址屬性,但我不知道是什麼,我猜想分配該屬性。我正在本地主機上運行我的Web服務。
更新1:
我加入了地址,我已經更新了原來的代碼。但是我收到錯誤消息,說沒有端點監聽地址=「http:// localhost:1252/SomeService.svc」。如果我訪問wcf url,我可以看到web服務。
感謝您的回覆!請參閱我已更新的原始帖子,在其中添加了地址,但仍然出現錯誤。 – azamsharp