C# MessageHeader属性未显示-wcf服务
在我的WCF服务中,我有一个C# MessageHeader属性未显示-wcf服务,c#,wcf,C#,Wcf,在我的WCF服务中,我有一个MessageContract类,它具有MessageHeader和MessageBodyMember属性。当我检查wsdl时,它是可见的,但是当我添加到我的uwp应用程序时,只有MessageBodyMember是可见的。我已经检查了在我添加服务引用之后添加的reference.cs,并且MessageHeader在其中不可见 服务合同 [MessageContract] public class RemoteFileInfo : IDisposable {
MessageContract
类,它具有MessageHeader
和MessageBodyMember
属性。当我检查wsdl
时,它是可见的,但是当我添加到我的uwp应用程序时,只有MessageBodyMember
是可见的。我已经检查了在我添加服务引用之后添加的reference.cs
,并且MessageHeader
在其中不可见
服务合同
[MessageContract]
public class RemoteFileInfo : IDisposable
{
[MessageHeader(MustUnderstand = true)]
public string FileName;
[MessageHeader(MustUnderstand = true)]
public long Length;
[MessageBodyMember(Order = 1)]
public System.IO.Stream FileByteStream;
public void Dispose()
{
if (FileByteStream != null)
{
FileByteStream.Close();
FileByteStream = null;
}
}
}
当我向UWP应用程序添加服务引用时
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="RemoteFileInfo", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
public partial class RemoteFileInfo {
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)]
public byte[] FileByteStream;
public RemoteFileInfo() {
}
public RemoteFileInfo(byte[] FileByteStream) {
this.FileByteStream = FileByteStream;
}
}
WSDL
<wsdl:message name="RemoteFileInfo">
<wsdl:part name="parameters" element="tns:RemoteFileInfo"/>
</wsdl:message>
<wsdl:message name="RemoteFileInfo_Headers">
<wsdl:part name="FileName" element="tns:FileName"/>
<wsdl:part name="Length" element="tns:Length"/>
</wsdl:message>
再次尝试添加服务引用。多次尝试,但没有帮助。不管怎样,这项工作已经不再需要,但谜团仍未解开:(