I have created a WCF Service hosted in IIS. In my web.config it has its endpoint configured like so:
<service behaviorConfiguration="JobServiceConfig" name="MyTest.JobService">
<endpoint address="" binding="basicHttpBinding" contract="MyTest.JobService"/>
</service>
I have a class library that will act as my client. For now, my class library is named JobServiceClient 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="basicHttpBinding" bindingConfiguration="BasicHttpBinding_JobService"
contract="JobServiceClient.JobProxy.JobService" name="BasicHttpBinding_JobService" />
</client>
This "wrapper" class is called JobService and has a method in it like:
public XmlElement GetJobTypeList()
{
XmlElement jobTypeList = null;
using (JobProxy.JobServiceClient jobServiceClient = new JobProxy.JobServiceClient())
{
jobTypeList = jobServiceClient.GetJobTypeList();
}
return jobTypeList;
}
I have a unit test in JobServiceClient 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.GetJobTypeList();
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?