Hi,
I am developing a solution for transfering data from android phone to the server (written in C#/.NET).
I created a WCF service and testing with emulator everything worked fine. Then when I tried to login from mobile phone (connected to home wifi network) I got the following exception message:
org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.5:8000 refused
I would really appreciate if anyonecould give a look at the config file and the interface and give any advice on how to enable connection.
web.config:
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="DefaultBinding" allowCookies="true" bypassProxyOnLocal="true" />
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="RESTFriendly">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="RESTServer.LoginService">
<endpoint address="" behaviorConfiguration="RESTFriendly" binding="webHttpBinding"
bindingConfiguration="DefaultBinding" contract="RESTServer.ILoginService" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
</configuration>
Interface:
[ServiceContract()]
public interface ILoginService
{
[WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "/username={username}&password={password}")]
[OperationContract]
Message Login(string username, string password);
}
Service implementation:
public class LoginService : ILoginService
{
public Message Login(string username, string password)
{
Message message = new Message();
SQLWorks sqlWorks = new SQLWorks();
string strSession = sqlWorks.Login(username, password);
string strMessage;
message.Session = strSession;
if(strSession == "")
{
strMessage = "Login failed! Please check your username/password!";
}
else
{
strMessage = "Login Successful";
}
message.ErrorMessage = strMessage;
return message;
}
}