开发者

WCF service contract not working with Microsoft Chart control as param

I have the following service contract:

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

[ServiceContract]
public interface IMyService
{
    [OperationContract]开发者_如何学Python
    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?


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

Try sending over an object containing the chart data instead.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜