繁体   English   中英

WCF应用程序已部署在Win7机器上并获得拒绝连接错误

[英]WCF app Deployed on Win7 Machine and get connection refused error

我已经基于Microsoft以下示例创建了Sync Framework应用程序并将其部署到新的Windows 7计算机上进行测试。 该应用程序运行正常,但是当我尝试进行通信时,出现以下错误:

无法连接到http:// localhost:8000 / RelationalSyncContract / SqlSyncService / TCP错误代码10061:无法建立连接,因为目标计算机主动拒绝了127.0.0.1:8000。

我想知道是否有我想念的东西。 这是我第一次使用WCF,并跟随microsoft示例代码。

我已禁用防火墙并为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>

谢谢您的帮助,不胜感激。

通过启用消息记录和跟踪 ,可以分析服务是否正确启动:

    <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文件,可以使用服务跟踪查看器 -Microsoft Windows SDK,通常在C:\\ Program Files \\ Microsoft SDKs \\ Windows \\ v6.0A \\ bin \\ SvcTraceViewer.exe中

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM