.NET 3.5 WF beta 2 SendActivity and generated proxy class

Published Tue, Aug 14 2007 2:24 PM

For preparing the Summer Classes of Class-A I stumbled on an exception which costs me a lot of time.

The situation was that I hosted a WF with Workflow services. The service is used by a client which is using a workflow for this also. The client workflow uses a SendActivity and the server a ReceiveActivity. (Just like the SequentialWorkflowService beta 2 sample). And like in the beta 2 sample I used a ServiceReference to connect the client to the service.

After configuring everything that is needed and running my projects, I received the following exception:

InvalidOperationException: Could not find a service endpoint with name 'ValidateCreditCardEndpoint' and contract type 'ClientWfHost.CreditCardServiceReference.IValidateCreditCard'

Well 'everyting' seems to be correct. The SendActivity its ServiceOperationInfo property is configured to the correct Interface. The ChannelTokens property its endpointName was correct and exists in the app.config. The app.config contains a single endpoint with a contract that correspondents to the name that is generated in reference.cs for the interface.
This name is configured on the ServiceContractAttribute with a ConfigurationName property which is located above the interface.
Ok found a difference here. This ConfigurationName has a different value than is configured on the SendActivity. This is how all 'references' to the interface looks like:

reference.cs: [ServiceContractAttribute(ConfigurationName = "CreditCardServiceReference.IValidateCreditCard")]
App.config contains an endpoint with: contract="CreditCardServiceReference.IValidateCreditCard"
and the SendActivity its ServiceOperationInfo property is ClientWfHost.CreditCardServiceReference.IValidateCreditCard

The solution to this problem was to make all 3 exactly the same. So I changed the ConfigurationName in reference.cs and contract in the app.config to ClientWfHost.CreditCardServiceReference.IValidateCreditCard. and voila it works like a charm. (I could also change the namespace of reference.cs) 

Not the most elegant to change generated code but I think it's perfect after a lot of hours puzzling.

Filed under:

Comments

# Rodrigo Reis said on Wednesday, August 29, 2007 10:24 PM

I have the same problem... and it isn't working, even with your solution.

I've found another reference in the .svcinfo file (in the same folder of reference.cs) and changed it too.

But it didn't work either.

Have you any other idea?

My namespace is like plat.wkf.worf_name.ws_name.

Regards.

# Rodrigo Reis said on Thursday, August 30, 2007 11:42 PM

Hi Naber,

You didn't moderate my last comment yet, but I've faced another problem that gives me the same message. The app.config and its derived workflow1.dll.config aren't been read by the workflow.

I've isolated this problem in a local example (simple dll) and I get the same result.

So, how did you get the app.config endpoints been read at runtime?

Is there any pitfall in the VS IDE?

Rodrigo

# Jeroen said on Tuesday, October 16, 2007 11:01 AM

Thanks for this great workaround. Otherwise it would have cost me a lot of time to find a solution. Especially to link the ServiceContractAttribute to this 'triangle'...

# roenepoen said on Tuesday, October 16, 2007 11:53 AM

Thanks for this great workaround. Otherwise it would have cost me a lot of time to find a solution. Especially to link the ServiceContractAttribute to this namespace triangle...

# lisha said on Wednesday, June 24, 2009 11:52 AM

I have the same problem. Changing it in all the 3 places mentioned above has not solved it. Any other suggestions please.

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 4 and 2 and type the answer here: