调试WCF中的命名管道

调试WCF中的命名管道,wcf,wcf-binding,Wcf,Wcf Binding,既然开发服务器不支持使用HTTP()以外的任何绑定,那么如何调试NetNamedPipeBinding呢 现在,当我使用Microsoft服务配置编辑器将绑定类型从basicHttpBinding更改为netNamedPipeBinding时,当我尝试按F5以使用弹出的自动生成的WCF工具时,会收到以下错误消息 System.InvalidOperationException:找不到与绑定为NetNamedPipeBinding的终结点的scheme net.pipe匹配的基址。注册的基址方案为

既然开发服务器不支持使用HTTP()以外的任何绑定,那么如何调试NetNamedPipeBinding呢

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

System.InvalidOperationException:找不到与绑定为NetNamedPipeBinding的终结点的scheme net.pipe匹配的基址。注册的基址方案为[http]。 位于System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri、Binding Binding、UrischemeKeydCollection基地址) 位于System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase主机、ServiceDescription说明、ServiceElement ServiceElement、操作'1 addBaseAddress) 位于System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader ConfigLoader、ServiceDescription description、ServiceElement serviceSection) 位于System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader ConfigLoader,ServiceDescription description,String configurationName) 在System.ServiceModel.ServiceHostBase.ApplyConfiguration()中 位于System.ServiceModel.ServiceHostBase.InitializeDescription(UrischemeKeydCollection基地址) 在System.ServiceModel.ServiceHost.InitializeDescription(类型serviceType,UrischemeKeydCollection baseAddresses) 位于System.ServiceModel.ServiceHost..ctor(类型serviceType,Uri[]baseAddresses) 在Microsoft.Tools.SvcHost.ServiceHostHelper.CreateServiceHost(类型,ServiceKind) 位于Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo信息)

配置:

<?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>

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

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

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

显示您的配置!!对于客户端和服务器

消息“找不到与绑定NetNamedPipeBinding的端点的scheme 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绑定


Marc

显示您的配置!!对于客户端和服务器

消息“找不到与绑定NetNamedPipeBinding的端点的scheme 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绑定


Marc

这些答案具有误导性。如果您是自托管WCF服务,则需要“基址”部分。但是,如果您使用IIS托管,则它不是必需的,也不会被使用。

这些答案具有误导性。如果您是自托管WCF服务,则需要“基址”部分。但是,如果您使用IIS托管,则它不是必需的,也不会被使用。

您是否配置了
net.pipe
基址?我认为WCF net pipes不支持跨计算机调用-您是否正在尝试这样做?我找不到在配置编辑器中设置net.pipe的方法。不,我只想在同一台计算机上的两个进程之间进行对话。您是否配置了
net.pipe
基址?我认为WCF net pipes不支持跨机器调用-您正在尝试这样做吗?我找不到在配置编辑器中设置net.pipe的方法。不,我只想在同一台计算机上的两个进程之间进行对话。