求助111C# webservice 部署到IIS上 调用时问题
这个是webservce 代码, 一个是默认的 一个是我写的
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public DataSet reader()
{
string ConStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\\MyPro\\data.accdb";
String SqlStr = "select * from login";
try
{
OleDbConnection con = new OleDbConnection(ConStr);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(SqlStr, con);
da.Fill(ds);
return ds;
}
catch (Exception ex)
{
return null;
}
在VS上按F5测试时,没有问题 ,将浏览器地址复制,在WF中添加引用服务,也还是可以的,能够读取数据库的信息。。
但是 !!!将WebService部署到IIS上,用地址访问时,出现了“/无法引用服务XXX”的错误,网上查了下,在web.config里添加了如下代码:
<!--<system.web>
<webServices>
<protocols>
<add name= "HttpPost"/>
<add name= "HttpGet"/>
</protocols>
</webServices>-->
然后,吾此噢,默认的WebService里的HelleWorld()可以调用,但是我自己写的没法子调用了,
出现的是:
<?xml version="1.0" encoding="UTF-8"?>
<DataSet xmlns="http://tempuri.org/123321" xsi:nil="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
就这些代码,看不懂啊。
之前成功的是数据库的内容。。
怎么回事啊?请教大神。。。已经卡了一周了,完全不知道怎么回事。。。