Silverlight Webservice“远程服务器返回错误:NotFound”

Silverlight Webservice“远程服务器返回错误:NotFound”,第1张

概述我有一个Silverlight应用程序,可以追溯可序列化的类列表.在这些类中有其他的可序列化类,其中一些也在列表中.事情是一切正常,直到我填写可序列化的列表之一,导致silverlight应用程序抛出异常“远程服务器返回错误:NotFound” 这是填充类的代码(不要被大量的代码吓倒,只是用信息填充类): private SCharacter getSCharacter(Character use 我有一个Silverlight应用程序,可以追溯可序列化的类列表.在这些类中有其他的可序列化类,其中一些也在列表中.事情是一切正常,直到我填写可序列化的列表之一,导致silverlight应用程序抛出异常“远程服务器返回错误: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有关的类的代码

更新:试图调试webservice本身,显然xml序列化有一个问题,你可以找到问题here

解决方法 下一次,您应该启用WCF跟踪:

把它放在你的web.config文件中:

<system.diagnostics>        <sources>      <source name="System.ServiceModel"              switchValue="information,ActivityTracing"              propagateActivity="true">        <Listeners>          <add name="traceListener"              type="System.Diagnostics.XmlWriterTraceListener"              initializeData= "c:\temp\WEBTraces.log" />        </Listeners>      </source>    </sources>  </system.diagnostics>

阅读更多这里:http://msdn.microsoft.com/en-us/library/ms733025.aspx

总结

以上是内存溢出为你收集整理的Silverlight Webservice“远程服务器返回错误:NotFound”全部内容,希望文章能够帮你解决Silverlight Webservice“远程服务器返回错误:NotFound”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/999043.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存