一个调用WebService的问题,请帮忙看看,谢谢!

cuijie 2008-01-18 11:10:21
环境:Silverlight 1.1,VS2008 bate 2

步骤:1、用VS2008建立一个WebService项目(基于.Net3.5),建立一个服务如下:

using System;
using System.Data;
using System.Linq;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml.Linq;

namespace TestService
{
/// <summary>
/// Summary description for MapService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
//[System.Web.Script.Services.ScriptService]
public class MapService : System.Web.Services.WebService
{
[WebMethod]
public stringTest()
{
System.Text.StringBuilder strB = new System.Text.StringBuilder();
for (int i = 0; i < 105000; i++)
strB.Append("t");

string str = strB.ToString();
return str;
}

}
}


2、用VS2008建立一个SL项目,添加WebServices引用,并在Page_loaded事件里调用

TestServices = new TestService();

string strTest = s.Test();

当把函数Test中i < 105000改成i<100000,整个调用过程正确,但如果是i < 105000,调用就会报错,错误是“Invoking error”,

为什么会这样?如果返回值用Object, 也一样会有这个问题,感觉好像返回值有长度限制,谁能帮帮我?



注:异步调用也测试了,也会有同样问题
...全文
227 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jenny0810 2010-02-06
  • 打赏
  • 举报
回复
没遇到过
knowledge_Is_Life 2008-05-01
  • 打赏
  • 举报
回复
没遇到过这种情况.
cuijie 2008-01-18
  • 打赏
  • 举报
回复
在注:出错得时候,我调试过,WebService是正确返回没有出错,出错在SL得到结果得时候
devote 2008-01-18
  • 打赏
  • 举报
回复
试设置一下 <httpRuntime maxRequestLength="102400"/>

8,735

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧