0
我很難在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