我有一个调用SQL查询并返回结果的web服务。查询正常,web服务也正常。
当我在Visual Studio中的debug中运行它时,它工作得很好( IP是localhost,而iis服务器来自Visual Studio),但是当我将它部署到IIS (在同一台计算机上)时,它什么也不返回。我不是指空的xml。
有什么问题吗?
我该如何修复它?
这是web服务,连接字符串在它的外面:
[WebMethod]
public string CC()
{
DataSet s = null;
String c;
System.Configuration.Configuration rootWebConfig =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("\\");
System.Data.SqlClient.SqlConnection sqlConnection1 = new System.Data.SqlClient.SqlConnection();
sqlConnection1.ConnectionString = connString.ConnectionString;
string select = "SELECT count (*) from [Customers]";
// Create an Adapter
SqlDataAdapter da = new SqlDataAdapter(select, sqlConnection1);
// Create a New DataSet
DataSet ds = new DataSet();
da.Fill(ds, "Customers");
return ds.Tables[0].Rows[0][0].ToString();
}下面是web.config文件:
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings>
<add name="ExecuTechConnectionString"
connectionString="user id=yuuvuv1; password=user;server=202.155.146.289\SQLEXPRESS;Trusted_Connection=no;database=YuYu; connection timeout=30"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" />
<authentication mode="Windows" />
</system.web>
</configuration>'我从soapUI-4.5.0软件调用用于测试的web服务,它使用SOAP来调用web服务。
谢谢,
发布于 2012-04-12 04:07:59
VS和IIS运行不同的服务器-前者专门用于VS开发。
在应用程序可以在IIS中运行之前,您必须检查设置-
假设上述各项都很好,如果您是allowing external connections to it via TCP/IP用户,请检查SQL Express
https://stackoverflow.com/questions/10106357
复制相似问题