![](/img/trans.png)
[英]SSAS Processing Cubes - Won't work in powershell but works in Visual Studio
[英]Web service that calls SQL won't work outside of Visual Studio
我有一個Web服務,該服務調用SQL查詢並返回結果。 查詢正常,Web服務正常。
當我在Visual Studio中的調試環境中運行它時,它運行良好(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服務。
謝謝,
VS和IIS運行的服務器不同-前者專門用於VS開發。
在您的應用程序可以在IIS中運行之前,您必須檢查設置-
假設以上情況都很好,請檢查SQL Express是否允許通過TCP / IP對其進行外部連接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.