0

由于开发服务器不支持使用除 HTTP 之外的任何绑定(http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/c7f173ea-61dc-4338-8883-60d616adc18f/),那么如何调试 NetNamedPipeBinding?

现在,当我使用 Microsoft 服务配置编辑器将绑定类型从 basicHttpBinding 更改为 netNamedPipeBinding 时,当我尝试按 F5 以使用弹出的自动生成的 WCF 工具时收到以下错误消息。

System.InvalidOperationException:找不到与具有绑定 NetNamedPipeBinding 的端点的方案 net.pipe 匹配的基地址。注册的基地址方案是 [http]。在 System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses) 在 System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress) 在 System.ServiceModel.ServiceHostBase。 LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection) at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description,

配置:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
  </configSections>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <bindings>
      <netNamedPipeBinding>
        <binding name="NewBinding0" />
      </netNamedPipeBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="InventoryServiceLibrary.Service1Behavior"
        name="InventoryServiceLibrary.InventoryService">
        <endpoint address="" binding="netNamedPipeBinding" bindingConfiguration=""
          contract="InventoryServiceLibrary.IInventoryService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Design_Time_Addresses/InventoryServiceLibrary/Service1/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="InventoryServiceLibrary.Service1Behavior">
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="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>
  </system.serviceModel>
</configuration>

解决方案 创建命名管道绑定后添加基地址

4

3 回答 3

3

向我们展示您的配置!既适用于客户端,也适用于服务器。

消息“找不到与绑定 NetNamedPipeBinding 的端点的方案 net.pipe 匹配的基地址。” 基本上说明了一切 - 它看起来好像您的服务器配置不包含任何使用net.pipe绑定的端点或基地址:

<services>
   <service name="xxxx">
       <host>
           <baseAddresses>
               <add baseAddress="http://localhost:8000/MyService" />
               <add baseAddress="net.tcp://localhost:8100/MyService" />
               <add baseAddress="net.pipe://localhost/" />

您还需要net.pipe在服务器的配置中指定至少一个端点才能使用此协议。

正如其他人所评论的那样,WCF 仅允许 net.pipe 绑定本地机器调用,例如,您不能从一台物理机器调用到另一台物理机器。如果您需要该功能,请改用 net.tcp 绑定。

马克

于 2009-08-21T05:10:38.217 回答
1

您始终可以只使用附加到进程,而不是直接在调试器中启动并将其附加到您的主机进程。

于 2009-08-21T03:31:17.200 回答
0

这些答案具有误导性。如果您是自托管 WCF 服务,您将需要 Base Address 部分。但是,如果您使用 IIS 进行托管,则不需要也不会使用它。

于 2013-08-01T06:43:57.420 回答