【发布时间】:2010-11-21 12:27:40
【问题描述】:
由于开发服务器不支持使用除 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,绑定绑定,UriSchemeKeyedCollection baseAddresses) 在 System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase 主机,ServiceDescription 描述,ServiceElement serviceElement,Action`1 addBaseAddress) 在 System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader,ServiceDescription 描述,ServiceElement serviceSection) 在 System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader,ServiceDescription 描述,字符串 configurationName) 在 System.ServiceModel.ServiceHostBase.ApplyConfiguration() 在 System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) 在 System.ServiceModel.ServiceHost.InitializeDescription(类型 serviceType,UriSchemeKeyedCollection 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>
解决方案 创建命名管道绑定后添加基地址
【问题讨论】:
-
您是否配置了
net.pipe基地址? -
我相信 WCF 网络管道不支持跨机器调用 - 您是否要这样做?
-
我找不到在配置编辑器中设置 net.pipe 的方法。不,我只想在同一台计算机上的两个进程之间交谈。
标签: wcf wcf-binding