2012-12-16 16 views
1

我有兩個應用程序。一個是winform服務器端,其中wcf服務託管,另一個是winform客戶端應用程序,我必須添加服務引用。沒有任何svc文件。所以,當我試圖創建在WinForm的WCF客戶端服務代理剛剛進入像如何在沒有svc文件的情況下創建WCF代理,該文件託管在Windows應用程序中

HTTP網址://本地主機:7998/WPFHost /或 的net.tcp://本地主機:7997/WPFHost/爲通過服務引用添加服務,然後出錯。 元數據包含無法解析的引用:'net.tcp:// localhost:7997/WPFHost /'。

在這裏我粘貼我的完整的app.config文件數據wcf服務器端的wcf託管。請指導我在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> 

回答

0

你應該嘗試創建服務代理MEX地址是在端口7996:

net.tcp://localhost:7996/WPFHost/mex 
+0

是的,我沒有,但得到了同樣的錯誤。在app.config文件中發現任何錯誤。 – Thomas

+0

上面的配置對我有用 - 在第一次運行它之前,Windows防火牆彈出並且我接受它。 – csg

+0

我想創建代理。在那裏我嘗試添加服務ref,並把網址net.tcp:// localhost:7996/WPFHost/mex然後服務參考窗口給出了無法找出service.i只是不明白爲什麼會發生錯誤... .i在我的服務類中沒有svc文件。請分享如果你知道任何trick.thanks – Thomas

相關問題