Castle windsor 是否可以使用castle windsor fluent api启用IncludeExceptionDetailInFaults?
我得到了这个例外 由于内部错误,服务器无法处理该请求。 有关错误的详细信息,请启用 IncludeExceptionDetailInFaults(来自 或从中的服务器上的配置行为) 命令将异常信息发送回客户端,或打开 根据Microsoft.NET Framework 3.0 SDK文档和 检查服务器跟踪日志 我想用fluent api添加此配置Castle windsor 是否可以使用castle windsor fluent api启用IncludeExceptionDetailInFaults?,castle-windsor,servicebehavior,wcffacility,Castle Windsor,Servicebehavior,Wcffacility,我得到了这个例外 由于内部错误,服务器无法处理该请求。 有关错误的详细信息,请启用 IncludeExceptionDetailInFaults(来自 或从中的服务器上的配置行为) 命令将异常信息发送回客户端,或打开 根据Microsoft.NET Framework 3.0 SDK文档和 检查服务器跟踪日志 我想用fluent api添加此配置 <serviceBehaviors> <behavior name="metadataAndDebugEnabled">
<serviceBehaviors>
<behavior name="metadataAndDebugEnabled">
<serviceDebug
includeExceptionDetailInFaults="true"
/>
<serviceMetadata
httpGetEnabled="true"
httpGetUrl=""
/>
</behavior>
</serviceBehaviors>
好的,您可以使用特定的容器选项注册一个
IServiceBehavior
实现,WCF集成设施将使用该实例
Container.Register(
AllTypes.FromAssemblyNamed("My.Server.Services")
.Pick().If(type => type.GetInterfaces().Any(i => i.IsDefined(typeof(ServiceContractAttribute), true)))
.Configure(configurer => configurer.Named(configurer.Implementation.Name)
.LifeStyle.PerWcfOperation()
.AsWcfService(
new DefaultServiceModel()
.AddEndpoints(
WcfEndpoint.BoundTo(new NetTcpBinding { PortSharingEnabled = true }).At(string.Format("net.tcp://localhost:6969/{0}", configurer.Implementation.Name)),
WcfEndpoint.BoundTo(new NetNamedPipeBinding()).At(string.Format("net.pipe://localhost/{0}", configurer.Implementation.Name)))
.PublishMetadata()
)
)
.WithService.Select((type, baseTypes) => type.GetInterfaces().Where(i => i.IsDefined(typeof(ServiceContractAttribute), true))));