Link to home
Start Free TrialLog in
Avatar of KaranGupta
KaranGupta

asked on

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
Avatar of Kiran Sonawane
Kiran Sonawane
Flag of India image

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
Avatar of KaranGupta
KaranGupta

ASKER

But I am using WCF with visual studio 2005 express version
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();
Hi

That is what I am saying. I have not set it but still I can use the function
Please show your code. zip file
Hi

Please rename the file to .rar then unrar it. sample-app.txt
ASKER CERTIFIED SOLUTION
Avatar of Kiran Sonawane
Kiran Sonawane
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And I guess,  you are adding the reference using http://localhost/TestService in your TestWCFApp
Hi sonawanekiran

I am adding as a reference in TestWcfApp in the same manner we normally add dll.
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)