我正在开发服务器应用程序。它是一个在服务器机器上运行的Windows服务。为了与服务器服务交互,我公开了WCF服务。其他客户端可以通过使用WCF服务与服务器进行交互。但它限制了用户只开发基于Windows的系统,我们也决定公开SOAP服务。我处于同样的发展中。 SOAP服务在IIS上运行并与WCF服务交互,但用户不知道WCF服务,而只知道SOAP。 WCF服务使用用户定义的/复杂的数据类型。当我在SOAP项目中使用WCF服务(与服务器交互)时,可以访问用户定义的类型(WCF使用的)。我公开了一个方法并试图访问结果,但引发了“NetDispatcheFaultException”。有几个用户定义的类型,但它是创造问题的类型如下:运行SOAP服务时出现异常
public class ServerConfig
{
private List<License> _licenseConfiguration;
public ServerConfig()
{
_licenseConfiguration = new List<License>();
}
[XmlArray("licenseconfiguration", IsNullable = true)]
[XmlArrayItem("license", typeof(License))]
public List<License> LicenseConfiguration { get { return _licenseConfiguration; } set { _licenseConfiguration = value; } }
public string[] AcquiredLicenses
{
get
{
int index = 0;
string[] licenses = new string[LicenseConfiguration.Count];
foreach (License lic in LicenseConfiguration)
{
licenses[index] = Utils.GetUserFriendlyNameFor(lic.LicenseName);
index++;
}
return licenses;
}
}
}
public class License
{
[XmlAttribute("licensename")]
public LicenseTypes LicenseName { get; set; }
[XmlAttribute("licensecount")]
public int LicenseCount { get; set; }
public License()
{
this.LicenseName = LicenseTypes.None;
this.LicenseCount = 0;
}
public License(LicenseTypes licenseName)
{
this.LicenseName = licenseName;
this.LicenseCount = 0;
}
public FbFLicense(LicenseTypes licenseName, int count)
{
this.LicenseName = licenseName;
this.LicenseCount = count;
}
}
当SOAP服务运行时,我调用下面的方法,这反过来调用WCF方法:
[WebMethod]
public ServerConfig GetServerConfiguration()
{
return base.ServerConfiguration();//.ServerConfiguration();
}
在调用此方法一切顺利执行对WCF的一面,但它抛出以下异常SOAP的一面:
为什么我t正在发生?建议一些方法来解决这个问题。如果任我从SERVERCONFIG类中删除
public string[] AcquiredLicenses
财产或者只是改变从“字符串[]”到“列表(字符串)”的返回类型此异常消失。 任何IDea?