tjuwdowl 2015-01-09 06:36 采纳率: 100%
浏览 14749
已采纳

c#调用webservice 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例

“/”应用程序中的服务器错误。

服务器无法处理请求。 ---> 未将对象引用设置到对象的实例。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.ServiceModel.FaultException: 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例。

源错误:

行 128:

行 129: public string[] getWeather(string theCityCode, string theUserID) {
行 130: return base.Channel.getWeather(theCityCode, theUserID);
行 131: }
行 132:

源文件: c:\Users\Administrator\Desktop\WebApplication2\Service References\WeatherWS\Reference.cs 行: 130

堆栈跟踪:

[FaultException: 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例。]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +10733331
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +336
WebApplication2.WeatherWS.WeatherWSSoap.getWeather(String theCityCode, String theUserID) +0
WebApplication2.WeatherWS.WeatherWSSoapClient.getWeather(String theCityCode, String theUserID) in c:\Users\Administrator\Desktop\WebApplication2\Service References\WeatherWS\Reference.cs:130
WebApplication2.WebForm1.test() in c:\Users\Administrator\Desktop\WebApplication2\WebForm1.aspx.cs:19
WebApplication2.WebForm1.Page_Load(Object sender, EventArgs e) in c:\Users\Administrator\Desktop\WebApplication2\WebForm1.aspx.cs:34
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

 namespace WebApplication2

{
public partial class WebForm1 : System.Web.UI.Page
{
protected void test() {
WeatherWS.WeatherWSSoapClient w = new WeatherWS.WeatherWSSoapClient("WeatherWSSoap");
string[] infos = new string[50];
if(w.getWeather("天津","")!=null)
infos = w.getWeather("天津", " ");
}
protected void Page_Load(object sender, EventArgs e)
{
test();
}

  • 写回答

6条回答

  • threenewbee 2015-01-09 10:09
    关注

    图片说明

    不能发代码,被封杀2次了。看图片中的回答。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 MATLAB怎么通过柱坐标变换画开口是圆形的旋转抛物面?
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿