还是一个关于SOAPEXCEPTION问题的处理 高手来帮帮忙啊

Double_Lan_2975 2010-02-05 11:02:22
ApplicationManager.SensorInfoAndDataList sensorAndData = appManager.GetDataByPolygonQuery(polygon, polygon, "", types);
if (sensorAndData != null)
{
int length = Math.Min(sensorAndData.Sensors.Length, sensorAndData.Data.Length);
for (int i = 0; i < length; i++)
{
if (sensorAndData.Sensors[i] != null)
Console.Write(i + " - Sensor:"
+ sensorAndData.Sensors[i].sensorName + ","
+ sensorAndData.Sensors[i].publisherName + ";");
if (sensorAndData.Data[i] != null && sensorAndData.Data[i].Timestamps != null)
Console.Write(" Data" + i + ":"
+ sensorAndData.Data[i].Timestamps[0] + ","
+ sensorAndData.Data[i].Data[0] + ";");
Console.WriteLine();
}
}
这是我写的一段代码,运行后总是在红色语句那里显示:未处理的SOAPexception,具体如下
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at AppLib.AppManager.GetUniqueList(List`1 data, List`1 sensors, Boolean& isUniqueStations) in C:\SenseWeb\src\netembed\NetEmbed\SenseWebV3.1.1\Coordinator\AppLib\AppManager.cs:line 152
at AppLib.AppManager.GetFinalListofSensors(List`1& data, List`1& sensors) in C:\SenseWeb\src\netembed\NetEmbed\SenseWebV3.1.1\Coordinator\AppLib\AppManager.cs:line 198
at AppLib.AppManager.GetDataByPolygonQueryWithAuthentication(String userName, Guid passCode, PointF[] polygon, PointF[] viewport, String searchTerms, Int32[] sensorTypeIDs) in C:\SenseWeb\src\netembed\NetEmbed\SenseWebV3.1.1\Coordinator\AppLib\AppManager.cs:line 133
at AppLib.AppManager.GetDataByPolygonQuery(PointF[] polygon, PointF[] viewport, String searchTerms, Int32[] sensorTypeIDs) in C:\SenseWeb\src\netembed\NetEmbed\SenseWebV3.1.1\Coordinator\AppLib\AppManager.cs:line 71
at Service.GetDataByPolygonQuery(PointF[] polygon, PointF[] viewport, String searchTerms, Int32[] sensorTypeIDs)
--- End of inner exception stack trace ---
这是怎么回事呢 很着急 在线等
...全文
75 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Double_Lan_2975 2010-02-06
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 xray2005 的回复:]
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

应该告诉你了,长度不能小于0。
AppLib.AppManager.GetUniqueList(List`1 data, List`1 sensors, Boolean& isUniqueStations) in C:\SenseWeb\src\netembed\NetEmbed\SenseWebV3.1.1\Coordinator\AppLib\AppManager.cs:line 152


看看你这个AppManager.cs:line 152地方或者附近的地方,一般是你对一个长度为0的字符串进行某些操作。

是不是有SubString或者其他什么方法。

把你的AppManager.cs贴出来了。
[/Quote]
ApplicationManager.SensorInfoAndDataList sensorAndData = appManager.GetDataByPolygonQuery(polygon, polygon, "", types);
我把后面的代码全都注释了以后 仍然出现以上的情况
Double_Lan_2975 2010-02-05
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 xray2005 的回复:]
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

应该告诉你了,长度不能小于0。
AppLib.AppManager.GetUniqueList(List`1 data, List`1 sensors, Boolean& isUniqueStations) in C:\SenseWeb\src\netembed\NetEmbed\SenseWebV3.1.1\Coordinator\AppLib\AppManager.cs:line 152


看看你这个AppManager.cs:line 152地方或者附近的地方,一般是你对一个长度为0的字符串进行某些操作。

是不是有SubString或者其他什么方法。

把你的AppManager.cs贴出来了。
[/Quote]


ApplicationManager.Service appManager = new ApplicationManager.Service();



string userName = "name";
string passwd = "password";
UserManager.Service userManager = new UserManager.Service();
string passCode = userManager.GetPassCode(userName, passwd).ToString();
这是前面变量的定义
xray2005 2010-02-05
  • 打赏
  • 举报
回复
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

应该告诉你了,长度不能小于0。
AppLib.AppManager.GetUniqueList(List`1 data, List`1 sensors, Boolean& isUniqueStations) in C:\SenseWeb\src\netembed\NetEmbed\SenseWebV3.1.1\Coordinator\AppLib\AppManager.cs:line 152


看看你这个AppManager.cs:line 152地方或者附近的地方,一般是你对一个长度为0的字符串进行某些操作。

是不是有SubString或者其他什么方法。

把你的AppManager.cs贴出来了。

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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