【发布时间】:2015-08-20 13:54:49
【问题描述】:
在我的项目中,公开了多个 WCF 服务。我想为所有这些服务添加服务和端点行为。 我已经创建了这些行为,如下所示。
<behaviors>
<endpointBehaviors>
<behavior name="RequestInspectorBehavior">
<RequestInspectorBehaviorExtension />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="webby">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<RequestInspectorBehaviorExtension />
</behavior>
</serviceBehaviors>
</behaviors>
现在一种选择是,我可以将这些添加到我的个人服务中,如下所示。
<service name="Service1" behaviorConfiguration="webby">
<endpoint address="" behaviorConfiguration="RequestInspectorBehavior" binding="webHttpBinding" contract="CONTRACT_GOES_HERE" />
但我想知道的是,有没有一种方法可以为我的所有服务提供此服务和端点行为,而无需通过每个服务的名称显式添加这些。
【问题讨论】: