我如何将XmlReader从Web服务传递到Silverlight [英] how i can pass XmlReader from web service to silverlight

查看:148
本文介绍了我如何将XmlReader从Web服务传递到Silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我在Web服务中创建了此方法

[WebMethod]
公开XmlReader fromxml()
{
XmlReader x;
cmd.Connection = conn;
cmd.CommandText =从test_emp中删除*";
conn.Open();
x = cmd.ExecuteXmlReader();
conn.Close();
x.Read();
返回x;
}
并在Silverlight中

s.fromxmlCompleted + = new EventHandler< fromxmlCompletedEventArgs>(s_fromxmlCompleted);
s.fromxmlAsync();

}
void s_fromxmlCompleted(对象发送者,fromxmlCompletedEventArgs e)
{
如果(e.Result!= null)
{
SilverlightApplication34.ServiceReference1.XmlReader x;




}
}

我想将其从Web服务获取到我的Silverlight应用程序
尝试给我错误时
远程服务器返回错误:NotFound.

和x没有其他方法,这个方法
x.PropertyChanged

感谢您的帮助

hi everyone
i created this method in me web service

[WebMethod]
public XmlReader fromxml()
{
XmlReader x;
cmd.Connection = conn;
cmd.CommandText = "selete* from test_emp";
conn.Open();
x = cmd.ExecuteXmlReader();
conn.Close();
x.Read();
return x;
}
and in silverlight

s.fromxmlCompleted +=new EventHandler<fromxmlCompletedEventArgs>(s_fromxmlCompleted);
s.fromxmlAsync();

}
void s_fromxmlCompleted(object sender, fromxmlCompletedEventArgs e)
{
if (e.Result != null)
{
SilverlightApplication34.ServiceReference1.XmlReader x;




}
}

and i want get this from web service to my silverlight apps
when try give me error
The remote server returned an error: NotFound.

and x not have any thing else this medthod
x.PropertyChanged

thanks for any help

推荐答案

建议对:

1.确保可以从出现问题的计算机上访问clientaccesspolicy.xml和crossdomain.xml.

2.默认情况下,WCF服务添加wsHttpBinding.将其更改为basicHttpBinding.

突出显示的错误可能会消失.
Couple of suggestions:

1. Make sure that you can access clientaccesspolicy.xml & crossdomain.xml from the machine which is giving problem.

2. By default, WCF service adds wsHttpBinding. Change it to basicHttpBinding.

The highlighted error may go off.


当您修复NotFound错误时...

您不传递XmlReader对象.您将传递Xml数据并使用Silverlight的XmlReader类来解析它....
And when you fix the NotFound error...

You don''t pass XmlReader objects. You''d pass Xml data and use Silverlight''s XmlReader class to parse it....


这篇关于我如何将XmlReader从Web服务传递到Silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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