【发布时间】:2010-04-15 09:56:16
【问题描述】:
我创建了一个基于following sample from microsoft 的同步框架应用程序并将其部署到一台新的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>
谢谢,非常感谢您的帮助。
【问题讨论】:
-
我认为这可能与WCF服务主机没有启动有关..所以需要找到如何在部署机器上启动它..visual studio自动启动它..
标签: c# wcf wcf-binding wcf-client