3
我正在開發一個web服務,它返回我在web服務中定義的類的數組。當我測試它時,我得到:「System.InvalidOperationException:類型WebSite + HostHeader不是預期的。使用XmlInclude或SoapInclude屬性指定靜態未知的類型。」XmlInclude或SoapInclude
下面是部分代碼:
[WebService(Namespace = "http://WebSiteInfo.Podiumcrm.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebSite : System.Web.Services.WebService
{
public class WebSiteEntry
{
public string SiteName = "";
public string Comment = "";
public string IISPath = "";
public int SiteID = 0;
public ArrayList HostHeaders;
public WebSiteEntry()
{
}
}
public class HostHeader
{
public string IPAddress = "";
public int Port = 0;
public string URL = "";
public HostHeader()
{
}
}
[WebMethod(EnableSession = true)]
[TraceExtension(Filename = @"C:\DotNetLogs\WebSiteServices.log")]
public WebSiteEntry[] WebSites()
{...}
}
當我嘗試:
[WebService(Namespace = "http://WebSiteInfo.Podiumcrm.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[XmlInclude(typeof(WebSiteEntry))]
[XmlInclude(typeof(WebSiteProperty))]
[XmlInclude(typeof(HostHeader))]
public class WebSite : System.Web.Services.WebService
{...}
我得到:「類型或命名空間名稱XmlInclude找不到(是否缺少using指令或者組件參考?)「
指出可以給我編譯和執行的咒語的人!
謝謝...