Visual Studio 2010 and .NET Framework 4 Beta 2 available for customers, Please check following link to install Visual Studio 2010 and .NET Framework 4 Beta 2, If you have any feedback about WCF/WF 4.0, Please let me know
http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx
<configuration>
<system.diagnostics>
<switches>
<add name="System.Workflow LogToTraceListeners" value="1" />
<add name="System.Workflow.Runtime" value="All" />
<add name="System.Workflow.Runtime.Hosting" value="All" />
<add name="System.Workflow.Runtime.Tracking" value="All" />
<add name="System.Workflow.Activities" value="All" />
<add name="System.Workflow.Activities.Rules" value="All" />
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="customListener"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="WFTrace.e2e" traceOutputOptions="Callstack,LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
CustomBinding mexBinding = new CustomBinding(MetadataExchangeBindings.CreateMexHttpBinding());
for (int i = 0; i < mexBinding.Elements.Count; i++)
{
HttpTransportBindingElement transport = mexBinding.Elements[i] as HttpTransportBindingElement;
if (transport != null)
{
transport.MaxReceivedMessageSize = int.MaxValue;
}
TextMessageEncodingBindingElement textMEBE =
mexBinding.Elements[i] as TextMessageEncodingBindingElement;
if (textMEBE != null)
{
textMEBE.ReaderQuotas.MaxArrayLength = textMEBE.ReaderQuotas.MaxBytesPerRead =
textMEBE.ReaderQuotas.MaxDepth = textMEBE.ReaderQuotas.MaxNameTableCharCount =
textMEBE.ReaderQuotas.MaxStringContentLength = int.MaxValue;
}
}
MetadataExchangeClient mexClient = new MetadataExchangeClient(mexBinding);
If you are very interested about contract first development, You can use this tool, If this tool is not meeting any of your contract first needs, please let me know
Web Services Contract First tool.
http://wscfblue.codeplex.com/
If you see any problem with NET TCP Service, You can use following config to debug NET TCP problems
On 64 bit machines, you have to add this info to C:\WINDOWS\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation\SMSvcHost.exe.config
On 32 bit machines, you have to add this info to C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\SMSvcHost.exe.config
<?xml version="1.0" encoding="utf-8"?>
<!-- The configuration file for SMSvcHost.exe -->
<configuration>
<runtime>
<gcConcurrent enabled="false" />
<generatePublisherEvidence enabled="false" />
</runtime>
<!-- Below are some sample config settings:
<system.serviceModel.activation>
<net.tcp listenBacklog="10" maxPendingConnections="100" maxPendingAccepts="2" receiveTimeout="00:00:10" teredoEnabled="false">
<allowAccounts>
// LocalSystem account
<add securityIdentifier="S-1-5-18"/>
// LocalService account
<add securityIdentifier="S-1-5-19"/>
// Administrators account
<add securityIdentifier="S-1-5-20"/>
// Network Service account
<add securityIdentifier="S-1-5-32-544" />
// IIS_IUSRS account (Vista only)
<add securityIdentifier="S-1-5-32-568"/>
</allowAccounts>
</net.tcp>
<net.pipe maxPendingConnections="100" maxPendingAccepts="2" receiveTimeout="00:00:10">
<allowAccounts>
// LocalSystem account
<add securityIdentifier="S-1-5-18"/>
// LocalService account
<add securityIdentifier="S-1-5-19"/>
// Administrators account
<add securityIdentifier="S-1-5-20"/>
// Network Service account
<add securityIdentifier="S-1-5-32-544" />
// IIS_IUSRS account (Vista only)
<add securityIdentifier="S-1-5-32-568"/>
</allowAccounts>
</net.pipe>
<diagnostics performanceCountersEnabled="true" />
</system.serviceModel.activation>
-->
<system.diagnostics>
<sources>
<source name="SMSvcHost" switchValue="Verbose">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="xml">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing"
propagateActivity="true">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\customers\smsvchost.e2e" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="xml" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">
<filter type="" />
</add>
<add initializeData="C:\customers\SMSvcHost_messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">
<filter type="" />
</add>
<add initializeData="C:\customers\SMSvcHost_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
</diagnostics>
</system.serviceModel>
</configuration>
If you are deploying your workflow application to multiple machines(NLB scenario) and all these machines are using same database for persistence , you need to use following config
(1)OwnershipTimeoutSeconds should be very high value ,so other hosts can't load these workflows
(2)Disable auto unload
SAMPLE WORKFLOW CONFIG:
<WorkflowRuntime Name="WorkflowServiceContainer">
<CommonParameters>
<add name="ConnectionString" value="Initial Catalog=SHARED;Data Source=localhost;Integrated Security=SSPI;"/>
</CommonParameters>
<Services>
<add type="System.Workflow.Runtime.Hosting.ManualWorkflowSchedulerService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add type="System.Workflow.Activities.ExternalDataExchangeService, System.Workflow.Activities, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" ConfigurationSection="ExternalDataExchange"/>
<add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" UnloadOnIdle="false" OwnershipTimeoutSeconds="5000" LoadIntervalSeconds="0" />
<add type="System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add type="System.Workflow.Runtime.Tracking.SqlTrackingService, System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" IsTransactional="false"/>
</Services>
</WorkflowRuntime>
AFTER WE ARE DONE WITH WORKFLOW, WE CAN CALL THIS METHOD TO UNLOAD WORKFLOW MANUALLY:
StateMachineWorkflowInstance stateInstance = new StateMachineWorkflowInstance(Application["WorkflowRuntime"] as WorkflowRuntime, instanceId);
stateInstance.WorkflowInstance.Unload();
// we improved WF designer performance in .NET 3.5 sp1 , After .NET 3.5 sp1 also, you may see some designer performance problems, you can follow these guide lines to increase WF designer performance
Commonly reported issues
1. Time taken to open a workflow document is long.
2. Opening Activity bind dialog is slow.
Reasons for slow down
The Workflow designer relies on parsing the source code in the current project to provide updated design information in workflow design surface, rules dialog intellisense etc. This is mainly to enable scenarios where picking up changes from the source even before the project has been rebuilt.
Tips to make designer perform better
1. Move all types used in workflows to a different project than where the workflows live.
Move interfaces, event types, custom activities, helper classes to a different project than in which the workflow resides. E.g. in the solution from a customer, there were about 10 project, with 10 workflows each and 10 associated event types. These types are all reparsed to update to build the design time type information every time the user changes workflows in the project. Moving these to a different assembly e.g just one project with all the types needed for the 10 workflow projects will help improve performance.
2. Reduce the number of workflows in a project.
Each workflow is a type ( directly in c#/vb, and indirectly in xoml case) that needs a design time type to be built by parsing, so if there are 10 workfows in a project, opening any workflow in the project for the first time means parsing all the other workflows as well. Classifying these workflows based on their function and grouping them in 2-3 workflows per project improved performance drastically.
3. Re-Factor large state machine workflows into smaller workflows
One example we found from a customer had 780 states and 1000 activity binds in the same workflow, leading to a InitializeComponent() of about 16000 lines. Factoring this state machine into smaller reusable workflows will making designer performance much better, and reduce a lot of redundant states.
4. Don’t do long running work in activity constructors
Activity constructors are called during design time also, so doing things like connecting to a database etc should never be done in constructors, this can make the designer take too long to open workflow documents using these activities.
REFERENCE:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3808068&SiteID=1