[求助]调用web服务,无法连接远程服务器?
用c#建立的一个网站,在service.cs中添加
[WebMethod]
public ulong fibonacci(int n)
{
if (n <= 2)
return (ulong)1;
else return (fibonacci(n - 1) + fibonacci(n - 2));
}
生成成功。
再用vb建立一个窗体程序,添加web引用,在button中写入以下代码
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim intInput As Integer
Dim intResult As UInt64
Dim strInput As String
strInput = TextBox1.Text
intInput = Int32.Parse(strInput)
Dim dd As webdy.localhost.Service
dd = New webdy.localhost.Service
intResult = dd.fibonacci(intInput)
TextBox2.Text = Str(intResult)
End Sub
生成成功,但是无法连接远程服务器。请大侠帮忙!