Search code examples
wcfentity-framework-4dto

WCF DTO transfer problem "Cannot convert from XX to XX"


I'm having the following problem:

cannot convert from 'MyProject.DataLayerServiceRef.MyDTO' 
to 'WCFService.MyDTO'

when i'm trying to call a method from the service to add an object to the database.

The problem is that my servicereference method is given a MyProject.DataLayerServiceRef.MyDTO TYPE while the service method wants a WCFService.MyDTO TYPE

What am I doing wrong here..? I'm new to WCF and simply cannot see what I have done wrong

What I'm trying to achieve is to create a new object client-side and use my wcf service to save it to the database (I have created a EDMX file in the service).

EDIT

now I get a new error..:

System.ServiceModel.FaultException: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs. Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at IDataLayerService.GetAnsatList() at DataLayerServiceClient.GetAnsatList() in H:\Projekt\DataLayerServiceRef.cs:line 233 at Projekt.Controllers.HomeController.Index() in H:\Projekt\Controllers\HomeController.cs:line 27

I've tried setting the "includeExceptionDetailInFaults", but that doesnt seem to help.. :(

The error occurs in this line of the homecontroller.cs:

AnsatDTO[] list = dls.GetAnsatList();

dls is my proxy and the GetAnsatList() method is a service method


Solution

  • Problem solved by creating a new WCF service from scratch.. :)