Solved

query regarding wcf

Posted on 2011-09-25
10
365 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:KaranGupta
  • 6
  • 4
10 Comments
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36597276
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
 

Author Comment

by:KaranGupta
ID: 36597608
But I am using WCF with visual studio 2005 express version
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36597645
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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

Author Comment

by:KaranGupta
ID: 36598265
Hi

That is what I am saying. I have not set it but still I can use the function
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36598282
Please show your code. zip file
0
 

Author Comment

by:KaranGupta
ID: 36598366
Hi

Please rename the file to .rar then unrar it. sample-app.txt
0
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 500 total points
ID: 36598396
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
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36598399
And I guess,  you are adding the reference using http://localhost/TestService in your TestWCFApp
0
 

Author Comment

by:KaranGupta
ID: 36599706
Hi sonawanekiran

I am adding as a reference in TestWcfApp in the same manner we normally add dll.
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36704139
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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question