出于某种原因,我无法让我的服务的 Net.Pipe 端点 (EP) 正常工作。
这是托管在 IIS7 中的 .Net 4.0 WCF 服务。
有两个错误...
- 首先,EP 不会提供元数据。
- 其次,EP 将无法实际工作 - 我正在通过作为 VS2010 一部分的 WCF 测试客户端对其进行测试。
我认为两者实际上都与同一个问题有关。
收到的实际错误是...
There was no endpoint listening at net.pipe://[machinename].[domainname]/Services/TestService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
我注意到的第一件事是,无论我在基地址中如何称呼我的管道,它都会重命名为 [machinename].[domainname],这看起来很奇怪。这在输出的服务元数据中很明显。但是,如果我在测试客户端中使用我的管道名称或这个重命名的名称,则两者都不起作用。
我还在 Windows 功能中启用了 WAS,为 IIS 中的所有协议设置了站点绑定,并且还在 IIS 的“启用的协议”框中输入了协议的名称(http、net.tcp、net.pipe)。我还检查了 Windows 服务中是否启动了“Net.Pipe 侦听器适配器”。
我的 http 和 net.tcp EP 都可以正常工作并返回元数据。
下面列出了我的配置 - 有没有人知道是什么阻止了这个 EP 的工作?我很确定它很简单!
<system.serviceModel>
<behaviors>
<!-- EP Behaviors -->
<endpointBehaviors>
<behavior name="PayloadMessageInspector">
<MessageHeaderBehavior />
<MessagePayloadBehavior />
</behavior>
</endpointBehaviors>
<!-- Service Behaviors -->
<serviceBehaviors>
<behavior name="GenericServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" policyVersion="Policy15" />
</behavior>
</serviceBehaviors>
</behaviors>
<!-- Bindings Section -->
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<!-- Basic Http Binding -->
<basicHttpBinding>
<binding maxReceivedMessageSize="10485760" maxBufferSize="10485760" maxBufferPoolSize="10485760">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
<!-- Net TCP Binding -->
<netTcpBinding>
<binding maxReceivedMessageSize="10485760" maxBufferSize="10485760" maxBufferPoolSize="10485760" />
</netTcpBinding>
<!-- Net Pipe Binding -->
<netNamedPipeBinding>
<binding maxReceivedMessageSize="10485760" maxBufferSize="10485760" maxBufferPoolSize="10485760" />
</netNamedPipeBinding>
</bindings>
<!-- Services Section -->
<services>
<!-- Membership Service -->
<service name="TestService" behaviorConfiguration="GenericServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost/Services/TestService.svc" />
<add baseAddress="net.tcp://localhost/Services/TestService.svc"/>
<add baseAddress="net.pipe://Dev/Services/TestService.svc"/>
</baseAddresses>
</host>
<!-- HTTP -->
<endpoint
address=""
binding="basicHttpBinding"
contract="ITestService" name="TestServiceBasicHttp" behaviorConfiguration="PayloadMessageInspector" />
<!-- NetTCP -->
<endpoint
address=""
binding="netTcpBinding"
contract="ITestService" name="TestServiceNetTcp" behaviorConfiguration="PayloadMessageInspector" />
<!-- NetPipe -->
<endpoint
address=""
binding="netNamedPipeBinding"
contract="ITestService" name="TestServiceNetPipe" behaviorConfiguration="PayloadMessageInspector" />
<!-- Mex (Net.Tcp / Net.Pipe ) -->
<endpoint name="TestServiceNetTcpMex" address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
<endpoint name="TestServiceNetPipeMex" address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" />
</service>
</services>
<!-- Extensions -->
<extensions>
<behaviorExtensions>
<add name="MessageHeaderBehavior" type="ServiceMessageHeaderBehavior, TestService.Logging" />
<add name="MessagePayloadBehavior" type="ServiceMessagePayloadBehavior, TestService.Logging" />
</behaviorExtensions>
</extensions>
</system.serviceModel>