Hello everybody! I have the next problem: {"Could not find default endpoint element that references contract 'IService1' 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 contract could be found in the client element."} I have created at localhost WCF Service, than I run the next command: svcutil.exe http://localhost:51797/Service1.svc?wsdl I got two files *.CS and *.config, than I added them to my WinForms project. At my WinForms project I have created label and button: And added the next code:
private void button1_Click(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
Service1Client client = new Service1Client();
client.Close();
label1.Text = "Service Works!";
}
So, it doesn't work, how can I repair it? With what I have a problem? - Edited bymagesi Friday, June 19, 2009 7:30 PM
- Edited bymagesi Friday, June 19, 2009 7:31 PM
-
| | magesi Friday, June 19, 2009 7:24 PM | Hi magesi,
From my experience, the problem is mostly related to the configure file. When you copied two generated files to your project, you need to rename the configure file “output.config�to “app.config�to make the setting of the service active. The project configure file must be named “app.config�
By the way, you can also add the service reference via the user interface, not a command. Theseare the steps: 1. Right click the project to open the context menu. 2. Click menu item “Add Service Reference…� 3. On the dialog, fill the address textbox with the address of the service, such as http://localhost:46249/Service1.svc?wsdl. Then click “OK�
Let me know if this helps. Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread. - Edited byAland LiMSFT, ModeratorTuesday, June 23, 2009 7:58 AM
- Unmarked As Answer bymagesi Friday, June 26, 2009 11:30 AM
- Marked As Answer byAland LiMSFT, ModeratorFriday, June 26, 2009 9:51 AM
- Marked As Answer byAland LiMSFT, ModeratorThursday, July 16, 2009 2:23 AM
-
| | Aland Li Tuesday, June 23, 2009 3:44 AM | Usually I just add a service reference to my project when I want to use a wcf service with my app instead of using scvutil. Also is the service running when you try and call it?
Silverlight-Help.com | | Ken Tucker Saturday, June 20, 2009 6:14 PM | Also is the service running when you try and call it? Yes, of coure...Because I was working at localhost as you see, and you can see by the next link: http://localhost:51797/Service1.svc?wsdl Service worked under ASP.NET Development Server at that time. Usually I just add a service reference to my project... I just added a service reference to my WinForms project, before I have created the service. The aim is of my general project is => to build my own web-service and use it in my WinForms program. Best Regards, Oleg | | magesi Sunday, June 21, 2009 8:47 AM | Hi magesi,
From my experience, the problem is mostly related to the configure file. When you copied two generated files to your project, you need to rename the configure file “output.config�to “app.config�to make the setting of the service active. The project configure file must be named “app.config�
By the way, you can also add the service reference via the user interface, not a command. Theseare the steps: 1. Right click the project to open the context menu. 2. Click menu item “Add Service Reference…� 3. On the dialog, fill the address textbox with the address of the service, such as http://localhost:46249/Service1.svc?wsdl. Then click “OK�
Let me know if this helps. Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread. - Edited byAland LiMSFT, ModeratorTuesday, June 23, 2009 7:58 AM
- Unmarked As Answer bymagesi Friday, June 26, 2009 11:30 AM
- Marked As Answer byAland LiMSFT, ModeratorFriday, June 26, 2009 9:51 AM
- Marked As Answer byAland LiMSFT, ModeratorThursday, July 16, 2009 2:23 AM
-
| | Aland Li Tuesday, June 23, 2009 3:44 AM | Hi magesi,
Could you please tell me what results in after you tried my solution? Did you meet the same error? Could you give me more information or test results? This will help me to diagnosis the issue and find an appropriate solution for you. Thanks.
Best regards, Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread. | | Aland Li Tuesday, June 30, 2009 9:48 AM | Hi Aland Li , Sorry for my late answer. I coudn't answer, because was busy on another forum. Yes, when I have added web-reference as http://localhost:46249/Service.svc?wsdl at my WinForm project. It works fine. Thanks for your advice. But I have another question about WCF. When I just created WCF Service in Visuaal Studio, there is a description to use `svcutil.exe`, I think my error took place, because I follow the description. I go to CMD, then use svcutil.exe and go on by desccription. But it didn't work at all. I think I made some mistakes. How I can build service correct with svcutil.exe? Thanks Oleg Orlov | | magesi Tuesday, June 30, 2009 10:58 AM | Hi magesi,
Please follow this and tell me if it works.
From my experience, the problem is mostly related to the configure file. When you copied two generated files to your project, you need to rename the configure file “output.config�to “app.config�to make the setting of the service active. The project configure file must be named “app.config�
Regards, Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread. | | Aland Li Wednesday, July 08, 2009 10:56 AM | Thanks Aland, your post helped me. | | Dondre Wednesday, July 15, 2009 5:23 PM |
|