【问题标题】:Configure WCF as Named Pipe hosted on IIS7将 WCF 配置为托管在 IIS7 上的命名管道
【发布时间】:2015-07-22 10:30:54
【问题描述】:

我在 IIS7 上托管了两个不同的 WCF 服务。一种是配置为在命名管道上运行的数据库服务。托管在同一台机器上的另一个服务正在通过命名管道访问第一个服务,并配置为在 webhttp 上运行。

但是,当我从另一个服务调用数据库服务时,我收到以下错误

“在“net.pipe://localhost/iSPYDBService”上没有可以接受消息的端点侦听。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。

数据库服务配置文件片段

<system.serviceModel>
<services>
  <service name="DBService.Service">
    <endpoint address="net.pipe://localhost/iSPYDBService" 
              binding="netNamedPipeBinding" 
              contract="DBService.Contracts.IDBService"  
              bindingConfiguration="Binding1" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>

<bindings>
  <netNamedPipeBinding>
    <binding name="Binding1"                 
             closeTimeout="00:01:00"
             openTimeout="00:01:00"
             receiveTimeout="00:10:00"
             sendTimeout="00:01:00"
             transactionFlow="false"
             transferMode="Buffered"
             maxBufferPoolSize="524288"
             maxBufferSize="65536"
             maxConnections="10"
             maxReceivedMessageSize="65536">
      <security mode="Transport">
        <transport protectionLevel="EncryptAndSign" />
      </security>
    </binding>
  </netNamedPipeBinding>
</bindings>    
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

通过命名管道调用数据库服务的其他服务会引发上述错误。

       ChannelFactory<DBService.Contracts.IDBService> pipeFactory =
                new ChannelFactory<DBService.Contracts.IDBService>(
            new NetNamedPipeBinding(),
            new EndpointAddress("net.pipe://localhost/iSPYDBService"));

        pipeProxy = pipeFactory.CreateChannel();

        var categories = pipeProxy.GetCategories();

这两个服务都托管在 IIS 上。我已经在数据库服务中提供了 net.pipe 的绑定,并在“启用的协议”中添加了“http,net.pipe”。

【问题讨论】:

    标签: c# web-services wcf iis-7 named-pipes


    【解决方案1】:
    1. 您不能使用 IIS Express。

    2. 在 IIS 中(完整,非快速)...转到您的网站。

    关注这个面包屑:

    WCF 主机网站 > 管理应用程序 > 高级设置 > 启用的协议

    您可能已经设置了“http”或“http,net.tcp”。

    添加“net.pipe”(前面有逗号)

    如下所示。注意,不要加空格。

    http,net.tcp,net.pipe
    

    在这种情况下,神奇的是正确的值(“net.pipe”)。

    您可以在这里阅读更多信息

    Could not find a base address that matches scheme net.tcp

    【讨论】:

      【解决方案2】:

      以下内容应该会有所帮助:

      1. 清除服务配置中的地址,如address=""
      2. 在 IIS 中编辑站点的绑定,添加或更新 net.pipe 类型的站点绑定,并为“绑定信息”取一个合适的名称
      3. 将您的客户端配置更新为address="net.pipe://PROPER_NAME/YOUR_SERVICE.svc"
      4. 将客户端和服务端绑定的安全模式设置为无。
      5. 确保为 WCF 4.5 的命名管道激活或 WCF 3.5 的非 HTTP 激活启用了 Windows 功能

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-05
        • 1970-01-01
        相关资源
        最近更新 更多