Solved

query regarding wcf

Posted on 2011-09-25
10
369 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

624 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