I created a WCF Service and would like to test the one method I added using the WCF Test Client. When I originally created the method, it returned a DataTable. When I used the WCF Test Client to add the service, the service was added using the original app.config file. The method returning the DataTable showed an 'X' because I learned that you can't return this data type. So I created a class that contains the DataTable. The DataContract, Subject, is returned by the method. The code is below:
[ServiceContract]
public interface IPaging
{
[OperationContract]
Subject GetSubjectList(string strUserID);
[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite);
}
[DataContract]
public class Subject
{
DataTable dtSubjectData = new DataTable();
[DataMember]
public DataTable SubjectTable
{
get;
set;
}
}
The method details: namespace PagingService { public class Paging : IPaging { Subject cSubject = new Subject();
public Subject GetSubjectList(string strUserID)
{
....
}
}
}
Now, when I try to add the service to the WCF Test Client, I get the error: 'Service metadata cannot be accessible.' This is my app.config file:
<system.serviceModel>
<services>
<service name="PagingService.Paging" behaviorConfiguration="SimpleServiceBehavior">
<endpoint address="" binding="wsHttpBinding" contract="PagingService.IPaging">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/PagingService/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SimpleServiceBehavior">
<serviceMetadata httpGetEnabled="True" />
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
It seems to me that it is not with the app.config file because the original entries worked when the method returned a DataTable. But now the return type is now 'Subject', it is not updated somewhere.
When you change the method signature, is there some other place that needs to be changed that I am missing?
Thanks.