tags:

views:

327

answers:

2

I have the following service contract:

using System.Windows.Forms.DataVisualization.Charting;
...

[ServiceContract]
public interface IMyService
{
    [OperationContract]
    bool Print(Chart chart);
}

When I run attempt to host the service (in Visual Studio under the WCFTestClient) I get the following exception:

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

It seems to be an issue with the Chart type itself as changing this to something else works fine.

Any ideas?

A: 

Most likely this is due to the Chart type not being serializable.

Try sending over an object containing the chart data instead.

Shiraz Bhaiji
A: 

You can also check out the Chart Serializer

http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.chartserializer(VS.100).aspx

It helps handle the serialization for you, which I suspect is probably the reason why you may be getting the message posted.