由于开发服务器不支持使用除 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>
解决方案 创建命名管道绑定后添加基地址