下面是我的 app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="Indexer">
<endpoint address="net.tcp://localhost:8000/Indexer/" binding="netTcpBinding"
bindingConfiguration="TransactionalTCP" contract="Me.IIndexer" />
</service>
<service name = "Indexer" behaviorConfiguration = "MEXGET">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8000/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name = "MEXGET">
<serviceMetadata httpGetEnabled = "true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="TransactionalTCP"
transactionFlow="true"
/>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
出于某种原因,我无法访问运行它的机器上的 WCF 服务。任何人都可以发现错误吗?我已经启动并运行了 netTcpBinding 服务。
当我在 HTTP 中运行相同的程序时,它可以正常使用以下 .config 文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="IndexerServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8080/Indexer/"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Indexer" behaviorConfiguration="IndexerServiceBehavior">
<endpoint address="http://localhost:8080/Indexer/" binding="basicHttpBinding"
bindingConfiguration="" name="HTTP" contract="IIndexer" />
<endpoint address="http://localhost:8080/Indexer/MEX/" binding="mexHttpBinding"
bindingConfiguration="" name="MEX" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
我真的不知道我在做什么错..