public class StringWriterBehavior : IServiceBehavior
{
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
var host = (WorkflowServiceHost)serviceHostBase;
host.WorkflowExtensions.Add<TextWriter>(() => new StringWriter());
}
}
public class StringWriterElement : BehaviorExtensionElement
{
public override Type BehaviorType
{
get { return typeof(StringWriterBehavior); }
}
protected override object CreateBehavior()
{
return new StringWriterBehavior();
}
}
And the config file:<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name=“stringWriter“
type="OrderService.StringWriterElement, MyWorkflowService"/>
</behaviorExtensions>
</extensions>
<services>
<service name="OrderWorkflow“
behaviorConfiguration="OrderWorkflowBehavior">
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="OrderWorkflowBehavior">
<serviceMetadata httpGetEnabled="True"/>
<stringWriter />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
source:
http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/a9b45eaf-c8e2-444c-819d-e448868e68bb/
No comments:
Post a Comment