日期:2014-05-18  浏览次数:20687 次

关于Web 服务的菜鸟求教?
using   System;
using   System.Collections;
using   System.ComponentModel;
using   System.Data;
using   System.Diagnostics;
using   System.Web.Services;
using   System.Web.Services.Protocols;
using   System.Runtime.InteropServices   ;  
namespace   WebService1
{
///   <summary>
///   Service1   的摘要说明。
///   </summary>
[WebServiceAttribute(Namespace= "urn:schemas-syngress-com-soap ")]
public   class   Service1   :   System.Web.Services.WebService
{
public   Service1()
{
//CODEGEN:   该调用是   ASP.NET   Web   服务设计器所必需的
InitializeComponent();
}

#region   组件设计器生成的代码

//Web   服务设计器所必需的
private   IContainer   components   =   null;

///   <summary>
///   设计器支持所需的方法   -   不要使用代码编辑器修改
///   此方法的内容。
///   </summary>
private   void   InitializeComponent()
{
}

///   <summary>
///   清理所有正在使用的资源。
///   </summary>
protected   override   void   Dispose(   bool   disposing   )
{
if(disposing   &&   components   !=   null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

 
[System.Web.Services.WebMethod]
public   string   HelloWorld(string   input)
{
return   input;
}

[System.Web.Services.WebMethod]
public   double   AverageScore(double[]score)
{
double   sum=0;
for(int   i=0;i <=score.Length;i++   )
                        sum+=score[i];
return   sum/score.Length;    
}
}
}


//我在浏览器中输入
http://localhost/WebService1/Service1.asmx/HelloWorld?input=hello
总是提示:
请求格式无法识别。  
说明:   执行当前   Web   请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  

异常详细信息:   System.InvalidOperationException:   请求格式无法识别。

源错误:  

执行当前   Web   请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。    

大家帮帮忙


------解决方案--------------------
我还有点资料:
我可以发给你,总之多互相交流吗?
QQ;30654265
http://localhost/WebService1/Service1.asmx/HelloWorld?input=hello