【发布时间】:2013-01-24 11:14:22
【问题描述】:
我有一个问题,您如何从另一台 PC 调用 Web 服务我在 Windows 7 中有一个使用 IIS 6.1 的 Web 服务,另一台 PC 在 Windows XP 中有一个 IIS 6,Web 服务使用 Web 应用程序在 localhost 中工作,现在唯一的事情是我正在尝试从另一台 PC 调用 Web 服务,但现在不知道该怎么做,我必须提到的一件事是我没有将 Visual Studio 用于我的 Web 服务和 Web 应用程序,我将所有代码写在一个文本块中并使用 Web 浏览器查看 Web 应用程序,所以问题是另一台 PC 的 Web 应用程序也将被写在一个文本块中,但我现在什至不知道如何调用。
当我从同一台 PC 调用时,我使用了 Web 服务中的下一个代码,这是一个简单的示例:
<%@ WebService language="C#" class="FirstService" %>
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using System.Web.Services;
[WebService(Namespace="http://localhost/MyWebServices2/")]
public class FirstService : WebService
{
[WebMethod]
public double[][] Size(int X_1,int Y_1)
{
double [][] dime = new double [X_1][];
for (int r=0;r < X_1; r++)
{
dime[r] = new double[Y_1];
}
return dime;
}
}
Web 应用程序使用了下一个代码:
<script runat="server">
void loadFile_Click(Object sender, EventArgs e)
{
int x1=0,y1=0;
x1= Convert.ToInt32(txtNum1.Text);
y1= Convert.ToInt32(txtNum2.Text);
FirstService mySvc = new FirstService();
mySvc.Tamano(x1,y1);
}
</script>
是否需要更改我的代码的某些部分?或者所有的变化都来自另一台 PC 的 Web 应用程序?
【问题讨论】:
标签: asp.net web-services web-applications iis-6