【发布时间】:2012-01-23 08:42:17
【问题描述】:
我已经对一些 WCF + Windows 服务进行了测试,并且在远程开发机器上作为 Windows 服务运行时可以正常工作。除了一个。
为了调试,我尝试使用内置的“添加服务引用”托管 WCF(没有 Windows 服务),然后在 Visual Studio 中托管它(不知道主机叫什么)。
无论如何,我无法获得 Add Service Reference 以发现我的服务。
因为我使用的是 Windoes 服务,所以我使用的是 TCP 的东西。这是我所做的一些事情,都在我正在添加服务引用的 winforms 应用程序中:
添加项目 > 属性 > 调试 > 命令行参数:/client:"WcfTestClient.exe" 但 exe 不运行。
还有我的 App.Config
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:32279/SYNC" binding="netTcpBinding"
bindingConfiguration="tcpSyncBindingConfig" contract="Company.Data.Sync.ILocalCacheSyncContract"
name="tcpSyncClientEP" />
</client>
<bindings>
<netTcpBinding>
<binding name="tcpSyncBindingConfig" maxReceivedMessageSize="6553600" />
</netTcpBinding>
<mexTcpBinding>
<binding name="tcpMexBindingConfig" />
</mexTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="svcBehavior" name="Company.Data.Sync.Services.LocalCacheSyncService">
<endpoint address="net.tcp://localhost:32279/Sync" binding="netTcpBinding"
bindingConfiguration="tcpSyncBindingConfig" name="tcpSyncListenEP"
contract="Company.Data.Sync.Services.ILocalCacheSyncContract" />
<endpoint address="net.tcp://localhost:32279/Sync/mex" binding="mexTcpBinding"
bindingConfiguration="tcpMexBindingConfig" name="tcpMexEP" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="svcBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
旁注:ServiceOperation 正在返回 Microsoft.Synchronization.Data.xxx sutff,例如 SyncContext。我可能需要在 Winforms 中添加引用?或者“添加服务参考”会为我添加它们吗?服务和合约由本地数据库缓存模板生成。可能与问题无关。
【问题讨论】:
标签: c# wcf visual-studio-2010