2010-04-15 48 views
0

我已經創建了一個基於following sample from microsoft的Sync Framework應用程序,並將其部署到新的Windows 7計算機上進行測試。該應用程序運行正常,但是當我試圖傳達我得到以下錯誤:WCF應用程序部署在Win7機器上並獲取連接拒絕錯誤

Could not connect to http://localhost:8000/RelationalSyncContract/SqlSyncService/ . TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8000.

我想知道如果有什麼我失蹤。這是我第一次使用WCF並遵循微軟示例代碼的經驗。

我已禁用防火牆併爲TCP和UDP打開端口8000。不知道接下來要看什麼。下面是我的App.config文件,如果這有幫助:

<?xml version="1.0"?> 
<configuration> 
    <system.web> 
    <compilation debug="true"/> 
    <httpRuntime maxRequestLength="32768" /> 
    </system.web> 
    <!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. --> 
    <system.serviceModel> 
    <services> 
     <service behaviorConfiguration="WebSyncContract.SyncServiceBehavior" name="WebSyncContract.SqlWebSyncService"> 
     <endpoint address="" binding="wsHttpBinding" bindingConfiguration="largeMessageHttpBinding" contract="WebSyncContract.ISqlSyncContract"> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8000/RelationalSyncContract/SqlSyncService/"/> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <bindings> 
     <wsHttpBinding> 
     <!-- We are using Server cert only.--> 
     <binding name="largeMessageHttpBinding" maxReceivedMessageSize="204857600"> 
      <readerQuotas maxArrayLength="1000000"/> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WebSyncContract.SyncServiceBehavior"> 
      <!-- To avoid disclosing metadata information, 
      set the value below to false and remove the metadata endpoint above before deployment --> 
     <serviceMetadata httpGetEnabled="True"/> 
      <!-- To receive exception details in faults for debugging purposes, 
      set the value below to true. Set to false before deployment 
      to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="True"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration> 

謝謝,您的幫助是非常感謝。

+0

我認爲它可能有些事情要做WCF服務主機沒有啓動..所以需要找到如何在部署機器上啓動它.. Visual Studio自動啓動它.. – Belliez 2010-04-15 14:36:13

回答

0

它可能如果服務正確與否開始,通過啓用消息記錄分析和跟蹤

<system.diagnostics> 
    <sources> 
     <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing"> 
     <listeners> 
      <add type="System.Diagnostics.DefaultTraceListener" name="Default"> 
      <filter type="" /> 
      </add> 
      <add name="ServiceModelMessageLoggingListener"> 
      <filter type="" /> 
      </add> 
     </listeners> 
     </source> 
     <source name="System.ServiceModel" switchValue="Information,ActivityTracing" 
     propagateActivity="true"> 
     <listeners> 
      <add type="System.Diagnostics.DefaultTraceListener" name="Default"> 
      <filter type="" /> 
      </add> 
      <add name="ServiceModelTraceListener"> 
      <filter type="" /> 
      </add> 
     </listeners> 
     </source> 
    </sources> 
    <sharedListeners> 
     <add initializeData="Your_svclog_file_here" 
     type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
     name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp"> 
     <filter type="" /> 
     </add> 
     <add initializeData="Your_svclog_file_here" 
     type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
     name="ServiceModelTraceListener" traceOutputOptions="Timestamp"> 
     <filter type="" /> 
     </add> 
    </sharedListeners> 
    <trace autoflush="true" /> 
    </system.diagnostics> 

在這種情況下,跟蹤是能夠登錄「信息」。重要的是看到渠道的創造。

要分析svclog文件,你可以使用服務跟蹤查看 - 微軟的Windows SDK,一般在C:\ Program Files文件\微軟的SDK \的Windows \ v6.0A \ BIN \ SvcTraceViewer.exe

相關問題