首页 文章

WCF属性在客户端上不可见

提问于
浏览
0

我目前正在开发一个WCF服务.net 4.0,它有2个属性 . 出于某种原因,这些属性在客户端上不可见 .

以下是该服务的代码 .

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Data;
using System.IO;
using System.Configuration;

using Longview.ScatIt.Data.Model;
using Longview.ScatIt.Service.Contract;

namespace Longview.ScatIt.Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "SqlJob" in code, svc and config file together.
    [ServiceContract]
    public class SqlJob : ISqlJob
    {

        #region IJob Members

        [DataMemberAttribute(Name="FileName")]
        internal string _fileName;

        [DataMemberAttribute(Name = "Location")]
        internal string _location;

        #endregion
    }
}

我在互联网上的某处读到,部分信任属性需要定义为“内部”,并在服务 Contract 中的AssemblyInfo.cs中添加[assembly:InternalsVisibleTo(“System.Runtime.Serialization”)]属性 .

我做错了什么,因为在服务器上看不到那些属性?

任何建议都是适当的

谢谢

1 回答

  • 0

    你混合了两件不同的东西:

    您现在拥有的是与数据成员签订的服务 Contract . 这没有意义 .

    以下是servicesdata contracts的更多链接 .

相关问题