Using a service reference i have this:
using (OperationContextScope scope = new OperationContextScope(client.InnerChannel)) {
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpDetails;
return predicate(client);
}
I want to know how can i do the same with a web reference instead of service reference. Using web reference the property InnerChannel doesn’t exist.
There is some way to do that?
If by “web reference” you mean a reference to an ASMX based web service then it cannot be done. A “service reference” creates a WCF based proxy in your client app to the service. A “web reference” creates a service proxy using the old .NET 1.1 days XML Web Service framework (ASMX). The
OperationContextScopeis only available to the WCF client.The fix is to create a “service reference” instead of a “web reference” to the service in question. That way, the proxy to both services will be WCF based and you can use
OperationContextScopefor both. WCF is backward compatible to any ASMX based service.