我在尝试为我的WCF服务工作时获取NetNamedPipeBinding时已经完成了耗尽的资源。我能够在这里找到NorthwindService示例。
对于NorthwindService示例,我有以下内容:
namespace NorthwindServices
{
public class Customer : ICustomer
{
public string GetCustomerName(int CustomerID)
{
return CustomerID.ToString();
}
}
}
namespace NorthwindServices
{
[ServiceContract]
public interface ICustomer
{
[OperationContract]
string GetCustomerName(int CustomerID);
}
}
该示例的配置如下:
<system.serviceModel>
<services>
<service name="NorthwindServices.Customer"
behaviorConfiguration="ServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/NorthwindServices/Customer"/>
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="CustomerService" binding="netNamedPipeBinding" contract="NorthwindServices.ICustomer"/>
<endpoint address="CustomerService/mex" binding="mexNamedPipeBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="False" httpsGetEnabled="False"/>
<!-- 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>
我为此定义了一个IIS站点,详情如下:
所以当我去添加服务参考&#39;我可以很好地提取参考。
然而,当我尝试在我的实际应用中做同样的事情时,我似乎仍然无法弄明白。我无法提取参考资料。
网站结构如下:
The top level site is an MVC site, and there is an "API" virtual directory below it where the service resides that I am trying to expose over NetNamedPipeBinding.
该网站的绑定如下:
我试图通过命名管道公开的服务的配置如下:
<system.serviceModel>
<services>
<service name="Site.API.Service.WorkItemQueueService"
behaviorConfiguration="ServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/WorkItemQueueService"/>
</baseAddresses>
</host>
<endpoint address="QueueService"
binding="netNamedPipeBinding"
contract="Site.API.Service.IWorkItemQueueService"/>
<endpoint address="QueueService/mex"
binding="mexNamedPipeBinding"
contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="false"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="True" aspNetCompatibilityEnabled="True"/>
服务实现与上面的客户服务相同,但显然已重命名以匹配上述配置。
当我尝试添加服务引用或查找元数据时,它无法找到它。
重要 - 所有预配置项(例如启动Net Pipe listerner和角色服务)都已完成,因此NorthwindServices示例可以正常工作。