Getting an error while calling WCF Service

636 views Asked by At

I have a simple WCF service running on a server machine.

Unit Test calling the service:

[TestMethod]
public void CreateLabelManagerTestMethod()
{
    // Arrange
    var client = new PrintServiceClient();

    // Act
    var manager = client.CreateLabelManager() as ILabelManager;

   // Assert
   Assert.IsNotNull(manager);
}

I am getting an exception:

{"An error occurred while receiving the HTTP response to [myservice.svc]. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details."}

[ServiceContract]
public interface IPrintService
{
    [OperationContract]
    ILabelManager CreateLabelManager();
}

public class PrintService : IPrintService
{
    public ILabelManager CreateLabelManager()
    {
        return new LabelManager();
    }
}

[DataContract]
public class LabelManager : ILabelManager
{        
    public ILabel CreateLabel(string templateFullFileName)
    {
        return new Label(templateFullFileName);
    }
}

[DataContract]
class Label : ILabel, IEnumerable<IField>, IDisposable
{
    public Label(string templateFullFileName)
    {
        this.TemplateFullFileName = templateFullFileName;          
    } 
    [DataMember]
    public string TemplateFullFileName { get; set;} //add set for serialization
}
0

There are 0 answers