Android连接到WCF
我无法连接到WCF服务,但它也会让我得到“启动超时已过期,放弃唤醒锁定!” 这是服务文件:Android连接到WCF,android,wcf,Android,Wcf,我无法连接到WCF服务,但它也会让我得到“启动超时已过期,放弃唤醒锁定!” 这是服务文件: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <connectionStrings> ...... </connectionStrings> <appSettings> <ad
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
......
</connectionStrings>
<appSettings>
<add key="HO" value=""/>
<add key="AutoUpdatePath" value="E:\AutoUpdate"/>
</appSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NewBinding0" maxBufferSize="2000000" maxReceivedMessageSize="2000000">
<readerQuotas maxStringContentLength="2000000" maxArrayLength="2000000" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="NewBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="NewBehavior" name="XONT.Common.Data.PDAServiceBLL.MyPDAService">
<endpoint address="http://192.168.1.11:7979/mytService" binding="basicHttpBinding"
bindingConfiguration="NewBinding0" contract="My.Common.Data.PDAServiceBLL.MyPDAService"/>
<host>
<baseAddresses>
<add baseAddress="http://192.168.1.11:7979/mytService"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
这是我的C#方法:
错误为:
我收到这样的错误消息**启动超时已过期,放弃唤醒锁
**
编辑:
我们如何增加时间?请帮帮我
提前感谢 您正在发送没有任何HTTP头或正文的空POST请求。基本HTTP绑定需要有效的SOAP请求和用于确定调用操作的SOAP操作。无论如何,我认为这应该给你一些错误,而不是超时。你能至少从你的android设备上打开这个吗:
http://192.168.1.11:7979/mytService?wsdl
手动执行所有SOAP通信相当复杂。您应该使用一些库来帮助您使用SOAP服务-检查。谢谢。我试过了,但还是遇到了同样的错误。在这种情况下,您的服务没有运行,或者您的android设备无法连接到托管服务的计算机。我不熟悉C#WCF。它没有在IIS服务器上运行。它是一个windows组件。在我的组织中,他们通过WCF向我提供数据,我必须将数据推送到android。服务正在运行。我想知道C#WCF不在服务器内部运行我们可以访问方法吗?服务不会将数据推送到您的设备。您的设备必须从服务中提取数据。您的组件必须“运行”且服务必须承载-将或放入浏览器中。如果您遇到一些错误,您的服务将无法运行。非常感谢。此服务现在运行良好。如何访问loadPassword_Executive(字符串)方法?
public SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); //set up request
request.addProperty("strExec", "WAT2"); //variable name, value. I got the variable name, from the wsdl file!
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //put all required data into a soap envelope
envelope.setOutputSoapObject(request); //prepare request
AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL);
httpTransport.debug = true; //this is optional, use it if you don't want to use a packet sniffer to check what the sent
//message was (httpTransport.requestDump)
httpTransport.call(SOAP_ACTION, envelope); //send request
SoapObject result=(SoapObject)envelope.getResponse(); //get response
return result;
}
namespace My.Common.Data.PDAServiceDAL
{
public class MyPDAServiceDAL
{
EcecutiveCode = "";
sqlConnection = ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
}
public List<string> loadPassword_Executive(string strExec)
{
EcecutiveCode = strExec;
sqlCon = new SqlConnection(sqlConnection);
List<string> list = new List<string>();
SqlCommand com;
SqlDataReader dr;
try
{
string sql = "select Password,BusinessUnit,PrimaryTerritoryCode,DefaultSalesWarehouse,DefaultSalesLocation from RD.Executive where ExecutiveCode = '" + strExec + "'";
com = new SqlCommand(sql, sqlCon);
sqlCon.Open();
dr = com.ExecuteReader();
if (dr.Read())
{
list.Add(dr[0].ToString());
list.Add(dr[1].ToString());
list.Add(dr[2].ToString());
list.Add(dr[3].ToString());
list.Add(dr[4].ToString());
}
}
catch (Exception e)
{
WriteToLog(e);
throw e;
}
finally
{
sqlCon.Close();
//dr.Close();
//dr.Dispose();
}
return list;
}
try {
SoapObject result=soap(METHOD_NAME, SOAP_ACTION, NAMESPACE, APPURL);
Log.w("log_tag",result.getPropertyCount()+ "=====" + result.getProperty(0).toString());
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}