A WCF service can return any type of data, really. That covers basic primitive types like int
or string
, but you can also create more advanced composite types (classes) and send them back.
HOWEVER: WCF is not designed to return HTML markup - that would be the totally wrong approach to things. WCF is a service - a service provides some functionality, you send in some data/parameters, you get back some data/output types.
WCF should not and must not ever be concerned with the actual representation of that data on the user's end - that's the job of your user interface - the ASP page or whatever you're dealing with.
So you could have a WCF service like this:
[ServiceContract]
interface IMyService
{
[OperationContract]
string SomeServiceMethod(string someInput);
}
and then call that from your client code something like this:
string result = MyService.SomeServiceMethod("Hello!");
but you should not ever write a WCF service that returns HTML markup or any other system-specific information.
And since WCF is a message-based system, the WCF service has absolutely no connection to your ASP page - it cannot participate in the ASP lifecycle or access the "Response" object or anything like that.