Using interface in service contract instead of concrete type in WCF
I have WCF service operation which accepts Interface as a input type. While calling this service operation from jQuery Ajax, I'm getting message "The server was unable to process the request due to an internal error". The jQuery code works file if the input type is concrete class. Please tell me if there is any way to achieve this kind of implementation.
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public cla开发者_高级运维ss TestService
{
[OperationContract]
[ServiceKnownType(typeof(User))]
public void SetUser(IUser request)
{
}
}
This is possible in WCF, so the question is what is the real exception message. Are you debugging the app when you make the call to the service using jQuery?
To get more information in the actual exception you should use svcTraceViewer. If you've not used svcTraceViewer before then you may want to look at a blog post on my blog
svcTraceViewer - Debugging WCF Sevices
精彩评论