C# Visual Studio中的Web服务引用问题
我很难在VS2010中使用Web服务引用。 我遵照以下指示: 我在Web服务中定义了一个简单的函数:C# Visual Studio中的Web服务引用问题,c#,asp.net,visual-studio-2010,web-services,C#,Asp.net,Visual Studio 2010,Web Services,我很难在VS2010中使用Web服务引用。 我遵照以下指示: 我在Web服务中定义了一个简单的函数: namespace WebService1 { public class Service1 : IService1 { public string HelloWorld(string name) { return "Hello "+name; } public double myFunct
namespace WebService1
{
public class Service1 : IService1
{
public string HelloWorld(string name)
{
return "Hello "+name;
}
public double myFunction(double a, double b)
{
return a + b;
}
}
}
它实现了以下接口:
namespace WebService1
{
[ServiceContract]
public interface IService1
{
[OperationContract]
string HelloWorld(string name);
[OperationContract]
double myFunction(double a, double b);
}
}
当我尝试在我的控制台应用程序中调用它时:
using WebTest.MyReference;
namespace WebTest
{
class Program
{
static void Main(string[] args)
{
Service1 service = new Service1();
Console.WriteLine(service.HelloWorld("Edouard")); //Works
double price = service.myFunction(2,3); //Doesn't Work
}
}
}
VS2010告诉我myFunction是这样定义的:
void service1.myFunction(double a, bool aSpecified, double b, bool bSpecified, out double myFunctionResult, out bool myFunctionResultSpecified)
这显然与我的功能不同!
我怎样才能像我定义的那样调用我的webservice函数呢?看看这个问题,我想这和你遇到的问题是一样的
请说明明确的问题。也许您缺少使用服务1的
部分,但参数似乎完全不同?我使用了:使用WebTest.MyReference;WebTest是我的控制台应用程序MyReference我的web引用名称和是的参数似乎不同这就是为什么我感到困惑的原因..可能重复