WCF:添加新的netNamedPipeBinding端点时出错

时间:2013-07-17 19:14:35

标签: wcf netnamedpipebinding

我有一个IIS托管的Web服务(

http://localhost/Directory.Server/Services/v2/Directory.svc/ws

)与wsHttpBinding一起使用。它由WebApp使用。我需要一个额外的端点用于具有命名管道的相同服务,以便我可以从在同一台机器上运行的另一个项目访问该服务。

我在web.config中进行了更改以公开namedpipe端点。但是,即使在我测试新的namedpipe端点之前,现有的wsHttpBinding端点也开始因此更改而抛出错误。

使用WebApp时出错 - 无法激活所请求的服务''。有关详细信息,请参阅服务器的诊断跟踪日志。

毫无疑问,添加namedpipe端点会导致问题。如果我修复了namedpipe问题,两个端点都可以正常工作。

以下是我的web.config更改 -

  <system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
  <wsHttpBinding>
    <binding name="wsHttp" maxBufferPoolSize="524288" maxReceivedMessageSize="10485760" messageEncoding="Mtom">
      <readerQuotas maxDepth="0" maxStringContentLength="0" maxArrayLength="0" maxBytesPerRead="0" maxNameTableCharCount="0" />
      <security mode="None">
        <transport clientCredentialType="None" />
        <message clientCredentialType="None" />
      </security>
    </binding>
  </wsHttpBinding>
  <netNamedPipeBinding>
    <binding name="Binding10" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="10485760">
      <security mode="Transport">
        <transport protectionLevel="EncryptAndSign"/>
      </security>
    </binding>
  </netNamedPipeBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="Default_Directory">
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="Default_Directory" name="Directory.Server.Services.v2.Directory">
    <endpoint address="ws" binding="wsHttpBinding" bindingConfiguration="wsHttp" name="wsHttp_Directory" contract="Directory.Server.Services.v2.IDirectory" />
    <endpoint address="mex" binding="mexHttpBinding" name="mex_Directory" contract="IMetadataExchange" />
    <endpoint address="net.pipe://localhost/Directory.Server/Services/v2/Directory.svc/np" binding="netNamedPipeBinding" bindingConfiguration="Binding10" name="namedPipe_Directory" contract="Directory.Server.Services.v2.IDirectory" />
  </service>
</services>

我做错了什么?请帮助。

1 个答案:

答案 0 :(得分:1)

在IIS上启用了WAS吗?命名管道需要启用WAS。参考 - http://msdn.microsoft.com/en-us/library/ms752253.aspx