Thursday, August 09, 2007

Problems with TFS and Orcas, WF & WCF hints

Yes, TFS is much worst than CVS. I can't add files to source control. This happens not only in Orcas (with the TFS client for Orcas), but with VS2005 as well.

When I was trying to close windows, I got an error:

Now, some WF tricks when using .NET 3.5.
1 - When trying to call a WCF service from WF, the channel factory will try to create a client on the fly. If you get an exception like "Could not find endpoint element with name 'WSDualHttpBinding_IBlahblahblah' and contract 'ServiceRef.Iblehblehbleh' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.", you have two options:
- try a fully qualified name for the service contract (the interface), including namespace. If it doesn't work (like it didn't for me), it may be that you are editing the wrong .config file! Yes, try to edit the .config file of the HOSTING application, not the workflow project. Tricky!
2 - If you have a SendActivity that calls the WCF service, you'll have to define a
ChannelToken. First register the channel token:

public static DependencyProperty ChannelTokenProperty = DependencyProperty.Register("ChannelToken", typeof(System.Workflow.Activities.ChannelToken), typeof(MyWorkflowApplication.MyWorkflow));
- There's a wonderful bug that resets some of ChannelToken's properties, like name, setting them to null! Before the send activity, recreate a new instance of a ChannelToken and assign the proper values. If you don't, the name property of your ChannelToken will be null and you'll get an exception like
Message "Argument value cannot be null or empty string.\r\nParameter name: name"
at System.Workflow.Runtime.Hosting.ChannelManagerService.CreateChannelFactory(LogicalChannel logicalChannel)
at System.Workflow.Runtime.Hosting.ChannelManagerService.GetChannelFactory(LogicalChannel logicalChannel)

No comments: