我有一個Silverlight應用程序,它可以檢索可序列化類的列表。在這些類中還有其他可序列化的類,其中一些也在列表中。事情是一切工作正常,直到我填寫的序列化類的列表之一,導致Silverlight應用程序拋出異常「遠程服務器返回一個錯誤:NotFound」Silverlight Webservice「遠程服務器返回錯誤:NotFound」
這是填充類的代碼(唐'牛逼由大量的代碼,它只是與信息填充類)被嚇倒:
private SCharacter getSCharacter(Character userCharacter)
{
var iqcb = userCharacter.CharacterBodies;
var iqcs = userCharacter.CharacterStats;
var iqgs = userCharacter.CharacterSettings;
var iqcp = userCharacter.CharacterPoints;
var iqcproj = userCharacter.CharacterProjectiles;
var currChar =
new SCharacter
{
characterID = userCharacter.characterID,
characterName = userCharacter.characterName,
characterClassID = userCharacter.characterClassID,
userUsername = userCharacter.userUsername
};
foreach (var cb in iqcb)
{
var scb = new SCharacterBody();
scb.body.bodyId = cb.bodyId;
scb.body.bodyName = cb.Body.bodyName;
scb.bodyPart.bodyPartId = cb.BodyPart.bodyPartId;
scb.bodyPart.bodyPartName = cb.BodyPart.bodyPartName;
currChar.characterBodyList.Add(scb);
}
foreach (var cs in iqcs)
{
var scs =
new SCharacterStat
{
characterID = cs.characterID,
statId = cs.statId,
characterStatId = cs.characterStatId,
statName = cs.Stat.statName,
statValue = cs.statValue
};
currChar.characterStatList.Add(scs);
}
foreach (var igs in iqgs)
{
var scs = new SCharacterSetting
{
characterID = igs.characterID,
modifierId = igs.GameSetting.modifierId,
modifierType = igs.GameSetting.Modifier.modifierType,
characterSettingId = igs.characterSettingId,
settingDescription = igs.GameSetting.settingDescription,
settingName = igs.GameSetting.settingName,
settingValue = igs.GameSetting.settingValue
};
var gss = igs.GameSetting.Stat;
scs.stat.statId = gss.statId;
scs.stat.statName = gss.statName;
currChar.characterSettingList.Add(scs);
}
foreach (var cp in iqcp)
{
var scp = new SCharacterPoint
{
characterID = cp.characterID,
characterPointsId = cp.characterPointsId,
pointsId = cp.pointsId,
pointsName = cp.Point.pointsName,
pointsValue = cp.pointsValue
};
currChar.characterPointList.Add(scp);
}
foreach (var cp in iqcproj)
{
var scp =
new SCharacterProjectile
{
characterId = cp.characterId,
characterProjectileId = cp.characterProjectileId,
particleId = cp.Projectile.particleId,
projectileHeight = cp.Projectile.projectileHeight,
projectileWidth= cp.Projectile.projectileWidth,
damageId =cp.Projectile.damageId,
damageDuration = cp.Projectile.Damage.damageDuration,
damageValue = cp.Projectile.Damage.damageValue,
projectileName = cp.Projectile.projectileName
};
scp.force.forceName = cp.Projectile.forceName;
scp.force.impulseX = (float)cp.Projectile.Force.impulseX;
scp.force.impulseY = (float)cp.Projectile.Force.impulseY;
scp.force.torque = (float)cp.Projectile.Force.torque;
scp.projectileParticle.particleId = cp.Projectile.particleId;
scp.projectileParticle.particleName = cp.Projectile.Particle.particleName;
foreach (var psv in cp.Projectile.Particle.ParticleSettingValues)
{
var spsv = new SParticleSettingValue();
spsv.particleId = psv.particleId;
spsv.particleSettingID = psv.particleSettingID;
spsv.particleSettingName = psv.ParticleSetting.particleSettingName;
spsv.particleSettingValue = psv.particleSettingValue1;
spsv.particleSettingValuesID = psv.particleSettingValueID;
scp.projectileParticle.particleSettingList.Add(spsv);
}
foreach (var pc in cp.Projectile.Particle.ParticleColours)
{
var spc = new SParticleColour();
spc.colourHex = pc.colourHex;
spc.particleColourId = pc.particleColourId;
spc.particleId = pc.particleId;
scp.projectileParticle.particleColourList.Add(spc);
}
currChar.projectileList.Add(scp);
}
return currChar;
}
在過去的3行代碼有currChar.projectileList.Add(scp);
,如果我刪除了這一行的代碼一切工作正常。我認爲可能導致問題的是ciruclar引用,但我檢查了類,似乎無法找到任何。如果需要的話,我會粘貼有projectileList
更新做類的代碼:試着調試Web服務本身,顯然有一個與XML序列化的問題,你可以找到這個問題here
謝謝!我遇到的問題是根據您提供的鏈接上的說明找到的缺少dll的結果。 – 2010-10-20 15:22:23