qq_20797711 2015-08-30 08:53 采纳率: 0%
浏览 2594

实现天气,报错远程服务器返回错误: (500) 内部服务器错误。

///
/// CityName为用户当前要查寻的城市名称
/// 本方法返回一个数据组
/// CityPhoto.ImageUrl = "http://www.cma.gov.cn/tqyb/img/city/" + list[3]; //这里的list[3]是城市的图片
/// lsit[0] 所属省
/// list[1] 城市
/// list[2] 城市编号
/// list[3] 图片
/// list[4] 为天气预报时间
/// list[5] 当天天气情况
/// list[6] 温度

/// list[7] 风力情况
/// list[10] 今日实况
/// list[8] 当天天气图片
// list[9] 当天天气图片
// list[15] 第二天天气图片 (名称)
// list[16] 第二天天气图片
// list[20] 第三天天气图片
// list[21] 第三天天气图片
// list[11] 温馨提示
/// list[12] 第二天天气情况
/// list[13] 第二天温度
/// list[14] 风力情况
/// list[17] 第三天天气情况
/// list[18] 第三温度
/// list[19] 风力情况
/// list[22] 为城市信息
/// list[23] 返回作者
/// 本DLL文件来源于河软CSDN_net 3 :979170768
/// CSDN博客: http://write.blog.csdn.net/postlist
///
///
///
public static ArrayList Get_3day_weather(string CityName)
{
XmlTextReader xt = new XmlTextReader("http://www.webxml.com.cn/WebServices/WeatherWebService.asmx/getWeatherbyCityName?theCityName=宜昌" +CityName);
int i = 0;
ArrayList list = new ArrayList();
while (xt.Read())
{

            if (xt.NodeType == XmlNodeType.Text)
            {
                list.Add(xt.Value);

            }
        }
        xt.Close();
        list.Add("本DLL文件来源于河软CSDN_net 3 :979170768+++CSDN博客: http://write.blog.csdn.net/postlist");
        return list;

这个报错

[WebException: 远程服务器返回错误: (500) 内部服务器错误。]
System.Net.HttpWebRequest.GetResponse() +6542104
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy) +101
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy) +5655461
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +69
System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) +54
System.Threading.CompressedStack.runTryCode(Object userData) +70
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) +0
System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state) +92
System.Xml.XmlTextReaderImpl.OpenUrl() +132
System.Xml.XmlTextReaderImpl.Read() +308
System.Xml.XmlTextReader.Read() +13
weather.Bnn_Weather.Get_3day_weather(String CityName) in d:\专业操作信息库\WPF\weather\weather\Bnn_Weather.cs:51
weather.WeatherWeb.disp_weather(String city) in d:\专业操作信息库\WPF\weather\weather\WeatherWeb.aspx.cs:52
weather.WeatherWeb.Button1_Click(Object sender, EventArgs e) in d:\专业操作信息库\WPF\weather\weather\WeatherWeb.aspx.cs:60
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9628722
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

  • 写回答

2条回答 默认 最新

  • threenewbee 2015-08-30 09:42
    关注
     http://www.webxml.com.cn/WebServices/WeatherWebService.asmx/getWeatherbyCityName?theCityName=宜昌" +CityName
    

    已经包含“宜昌”了,再加上你的城市名,当然不行了。

    评论

报告相同问题?

悬赏问题

  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符