Skip to content

OperationContext.Current is null #3784

@AnReZa

Description

@AnReZa

I'm providing a WCF service in my .net core project via SoapCore. In one of the methods, I want to access the SOAP envelope header info. To test that, I've added the following code:

[ServiceContract]
public interface IDataService {
    [OperationContract]
    string TransmitObject(XElement node);
}

// -------------------------------------------------------------------------

public string TransmitObject(XElement node) {
    foreach(var header in OperationContext.Current.IncomingMessageHeaders) {
        Console.WriteLine(header.ToString());
    }

    return JsonConvert.SerializeXNode(node, Formatting.None);
}

However, in this case, the OperationContext.Current attribute is always null. What do I need to change in order to make that work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions