query regarding wcf

Hi

I have created one wcf service. Then I added the wcf  project as reference in a web based application. Even I can use the functions defined in the service. But If I check the configuration file of the service I can see that there is no address defined.

How I can use the service if there is no address defined in the endpoint in the configuration file.

Regards
Karan Gupta
KaranGuptaAsked:
Who is Participating?
 
Kiran SonawaneConnect With a Mentor Project LeadCommented:
Go to TestService >> web.config file and there you constructed the end point (address,binding,contract) under <system.serviceModel> tag

<endpoint address="http://localhost/TestService" binding="wsHttpBinding" contract="TestService.IService1">
0
 
Kiran SonawaneProject LeadCommented:
If you are using WCF 4, then defualt End Point is associated with the service, if we don’t configure any WCF endpoint.

Look at this detail article http://beyondrelational.com/blogs/dhananjaykumar/archive/2011/01/28/default-endpointsin-wcf-4-0.aspx
0
 
KaranGuptaAuthor Commented:
But I am using WCF with visual studio 2005 express version
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Kiran SonawaneProject LeadCommented:
Then you may be set your endpoint programatically. Like

        string baseAddress = "http://localhost:8080/wcfselfhost/";
        ServiceHost host = new ServiceHost(typeof(MyService), new Uri(baseAddress));

        // Create a BasicHttpBinding instance
        BasicHttpBinding binding = new BasicHttpBinding();

        // Add a service endpoint using the created binding
        host.AddServiceEndpoint(typeof(IEcho), binding, "echo1");

        host.Open();
0
 
KaranGuptaAuthor Commented:
Hi

That is what I am saying. I have not set it but still I can use the function
0
 
Kiran SonawaneProject LeadCommented:
Please show your code. zip file
0
 
KaranGuptaAuthor Commented:
Hi

Please rename the file to .rar then unrar it. sample-app.txt
0
 
Kiran SonawaneProject LeadCommented:
And I guess,  you are adding the reference using http://localhost/TestService in your TestWCFApp
0
 
KaranGuptaAuthor Commented:
Hi sonawanekiran

I am adding as a reference in TestWcfApp in the same manner we normally add dll.
0
 
Kiran SonawaneProject LeadCommented:
Correct. The URL you are using to add service reference in your TestWCFAPP is defined in web.config of you WCF  service project (which is TestService)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.