When i try to view MDIParent screen in designer mode I’m getting below exception…
`Could not find endpoint element with name ‘NetTcpBinding_IMyService’ and contract ‘ClientProxy.IMyService’ 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.’
Little background to understand my question more clearly…
I’ve a WCF server which I’m trying to consume in my Winform application. So i’ve created a separate class library in which i added service reference and created a proxy. I’ve copied the client endpoint info from app.config in class library to UI app.config file.
When i run the application everything is working fine but when i try to open MDIParent screen in designer mode its throwing above exception.
Note: I think i’m getting error because i’m trying to create a proxy object on NEW method (form constractor) if i comment that line – i’m able to view designer screen.
Please help 🙂
- Venky
If you instantiate the service in the form’s constructor, this could be the source of your problem.
If this is the case, wrap the service initialization in a test for DesignMode:
Update
It turns out that DesignMode is not supported in the constructor.
There are a couple of workarounds to choose from:
1) Use the following instead of the designmode test:
2) Move your initialization code from the constructor into the Form’s _load event and then use the DesignMode test.