【问题标题】:Is it Possible to turn on IncludeExceptionDetailInFaults with castle windsor fluent api?是否可以使用 Castle Windsor fluent api 打开 IncludeExceptionDetailInFaults?
【发布时间】:2012-01-21 02:20:09
【问题描述】:

我遇到了这个异常。

由于内部错误,服务器无法处理请求。 有关错误的详细信息,请打开 IncludeExceptionDetailInFaults(来自ServiceBehaviorAttribute 或从配置行为)在服务器上 命令将异常信息发送回客户端,或打开 根据 Microsoft .NET Framework 3.0 SDK 文档和 检查服务器跟踪日志。

我想用fluent api添加这个配置

<serviceBehaviors>
  <behavior name="metadataAndDebugEnabled">
    <serviceDebug
      includeExceptionDetailInFaults="true"
    />
    <serviceMetadata
      httpGetEnabled="true"
      httpGetUrl=""
    />
  </behavior>
</serviceBehaviors>

有办法吗?这是我目前的配置...

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))));

【问题讨论】:

    标签: castle-windsor servicebehavior wcffacility


    【解决方案1】:

    AFAIK 您可以使用容器的特定选项注册IServiceBehavior 实现,WCF 集成工具将使用该实例。

    【讨论】:

      猜你喜欢
      • 2012-01-23
      • 2010-09-12
      • 2011-04-02
      • 1970-01-01
      • 2014-12-03
      • 2010-10-26
      • 1970-01-01
      • 2012-12-16
      • 1970-01-01
      相关资源
      最近更新 更多