[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2854
  • Last Modified:

WCF Service. svcutil.exe will not generat app.config file...

Hi Experts,

We have recently created a WCF service and have it hosted and running very happily.

I'm now writing a client website using an Asp.Net web project and have added the service as a reference. This has generated all the necessary bits I need to access the service and classes etc.

I've added using System.ServiceModel to the code behind and am trying to create a proxy client to use with the reference. The line myref.MyServiceClient proxy = new myref.MyServiceClient(); throws a "Could not find default endpoint element that references contract.... etc.

I did try creating the proxy client class by running svcUtil.exe and adding the generated files to my app, but the utility didn't create an app.config - which it's supposed to do - right?

I'm using VS2010 Beta 2 and .Net 4.0, so not sure if I'm running into bugs, or I'm just not setting things up correctly. I'm also not sure if I'm even using the technology properly as WCF is very new to me. Can anyone shed any light on how to create a client web app for using WCF services that should work.

Many thanks!
2 Solutions
can u try adding the WCF service reference using the visual studio add reference method as it will add all the endponts configurations in the config files.

  right click on the project and select the options of add service reference

 manually using the svcutility is bit difficult.
keyukAuthor Commented:
I have found the solution.

I didn't have the endpoint and bindings defined properly in the web.config so the serverice wasn't advertising it's meta information properly.

I have changed the way I'm accessing the service and am now using a service reference for the project and this is automatically setting up the required binding info in the client project.

This area is very new to me but the learning curve has been massive! I'm going to use this technology in ebery new project as it's so powerful. Good luck to everyone who embraces this!!

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now