我得到了这个例外。
由于内部错误,服务器无法处理请求。有关错误的更多信息,请在服务器上打开 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))));