I have created a WCF Service hosted in IIS. In my web.config it has its endpoint configured like so:
<service behaviorConfigu ration="JobServ iceConfig" name="MyTest.Jo bService">
<endpoint address="" binding="basicH ttpBinding" contract="MyTes t.JobService"/>
</service>
I have a class library that will act as my client. For now, my class library is named JobServiceClien t It has a service reference to my service http://localhost:2269/MyTest/Service.svc
This project has a class that I will be using to act as a wrapper for the proxy, and with some of my logic in it.
In the app.config it has its end point configured like so:
<client
<endpoint address="http://localhost:2269/MyTest/Service.svc"
binding="basicH ttpBinding" bindingConfigur ation="BasicHtt pBinding_JobSer vice"
contract="JobSe rviceClient.Job Proxy.JobServic e" name="BasicHttp Binding_JobServ ice" />
</client>
This "wrapper" class is called JobService and has a method in it like:
public XmlElement GetJobTypeList( )
{
XmlElement jobTypeList = null;
using (JobProxy.JobSe rviceClient jobServiceClien t = new JobProxy.JobSer viceClient())
{
jobTypeList = jobServiceClien t.GetJobTypeLis t();
}
return jobTypeList;
}
I have a unit test in JobServiceClien t that runs correctly and actually returns me a list of job types.
My problem is when I have another application (Web app) try to consume this DLL and get a list of jobs by doing this:
JobService jobService = new JobService();
XmlElement jobServiceList = jobService.GetJ obTypeList();
I get an error that says "Could not find default endpoint element that references contract ..."
It seems like it is looking in my main app for the end point when it should be just using the GetJobTypeList method that encapsulates all of that for me.... any ideas on how I can get this to work correctly?