Solved

query regarding wcf

Posted on 2011-09-25
10
362 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
Comment Utility
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
Comment Utility
But I am using WCF with visual studio 2005 express version
0
 
LVL 17

Expert Comment

by:sonawanekiran
Comment Utility
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
 

Author Comment

by:KaranGupta
Comment Utility
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
Comment Utility
Please show your code. zip file
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:KaranGupta
Comment Utility
Hi

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

Accepted Solution

by:
sonawanekiran earned 500 total points
Comment Utility
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
Comment Utility
And I guess,  you are adding the reference using http://localhost/TestService in your TestWCFApp
0
 

Author Comment

by:KaranGupta
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now