Silverlight Webservice“远程服务器返回错误:NotFound" [英] Silverlight Webservice "The remote server returned an error: NotFound"

查看:28
本文介绍了Silverlight Webservice“远程服务器返回错误:NotFound"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Silverlight 应用程序,它检索可序列化类的列表.在这些类中还有其他可序列化的类,其中一些也在列表中.事情是一切正常,直到我填充导致 Silverlight 应用程序抛出异常远程服务器返回错误:NotFound"的可序列化类列表之一

I have a Silverlight application that retreives a list of serializable classes. In these classes there are other serializable classes some of which are also in a list. The thing is everything works fine until I fill one of the list of serializable classes that causes the silverlight application to throw the exception "The remote server returned an error: NotFound"

这是填充类的代码(不要被大量代码吓倒,它只是用信息填充类):

This is the code that fills the class (Don't be Intimidated by the large amount of code it's just filling the class with information):

  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); ,如果我删除那行代码,一切正常.我认为可能导致问题的原因是循环引用,但我检查了类,似乎找不到任何类.如果需要,我将粘贴与 projectileList

In the last 3 lines of code there is currChar.projectileList.Add(scp); , if I remove that line of code everything works fine. What I thought might be causing the problem is ciruclar references but I checked the classes and can't seem to find any. If needed I'll paste the code of the classes that have to do with projectileList

更新:尝试调试webservice本身,显然xml序列化有问题,你可以找到问题这里

Update: Tried to debug the webservice itself and apparently there is a problem with the xml serialization, you can find the question here

推荐答案

在我的 第二个问题.

这篇关于Silverlight Webservice“远程服务器返回错误:NotFound"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆