views:

4

answers:

1

I have basic WinForm user controls (view) whose intilization includes a presenter and model. The presenter includes calls to a wcf service. Recently an error has croped up that is very trying. Whenever I drag and drop one of these controls onto my design surface I am presented with an error that the endpoint with name "yadda" could not be found.

This same behavior occurs if I try to run the usercontrol test container. If however, I comment out the intialization, add the control to my form, save the form, go to the control and uncomment the intialization, build, and then run my app evrything works fine.

All my controls are in a Presentation project which has a reference to anothe rproject that containts the presenters and the models as well as a servic reference to my wcf service.

I am hoping someone out that encountered similar difficulties and will have some advise.

Thanks

+1  A: 

You're configuring the WCF endpoint in your app.config file. When you are using the designer, your code is running inside of Visual Studio, so WCF is looking in Visual Studio's config file and does not find your endpoint.

Do you want to make WCF calls at design time? If you do, you'll need to configure WCF programmatically so that it works without an app.config. Here is a post that shows how to do that: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/82457a59-44f9-4efb-a814-0ed5a1ec0074

If you don't want to make the calls at design time, you can check the DesignMode on your user control, and not create the proxy in your initialization code if it's True. Note that DesignMode isn't set until after your constructor runs, so you'll need to do this work in a Load event handler or an overridden OnLoad.

Quartermeister