Visual Studio的Web服务参考问题
问题描述:
我很难在VS2010中使用Web服务参考。 我跟着以下说明:当我试图把它在Visual Studio的Web服务参考问题
namespace WebService1
{
[ServiceContract]
public interface IService1
{
[OperationContract]
string HelloWorld(string name);
[OperationContract]
double myFunction(double a, double b);
}
}
:
namespace WebService1
{
public class Service1 : IService1
{
public string HelloWorld(string name)
{
return "Hello "+name;
}
public double myFunction(double a, double b)
{
return a + b;
}
}
}
它实现了以下接口: Instructions
我在Web服务定义的简单函数我的控制台应用程序:
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)
这显然不一样,用我的功能! 我如何能够像我定义的那样调用我的web服务函数?
请指出明确的问题。 – ChiefTwoPencils
也许你错过了'使用service1'部分,但参数看起来完全不同? – V4Vendetta
我用: 使用WebTest.MyReference; WebTest的是我的控制台应用程序 MyReference我的Web引用名 是的参数似乎型动物,这就是为什么我很困惑..的 – Ouado