WebServices does not interact with App
- by daemonfire300
I got a Silverlight App with-in a Web Project
Web
Silverlight
The web contains a service:
[WebService(Namespace = "svChat")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
//[System.Web.Script.Services.ScriptService]
public class GetIPService : System.Web.Services.WebService
{
public GetIPService ()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string GetIp()
{
return HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
}
}
And I got a class in my Silverlight App using the Service:
public class Client
{
private string ip;
private string created;
#region Properties
public string Ip
{
get { return ip; }
set { ip = value; }
}
public string Created
{
get { return created; }
set { created = value; }
}
#endregion
public Client()
{
}
public void SetIp()
{
ServiceReference1.GetIPServiceSoapClient scIpClient = new svChat.ServiceReference1.GetIPServiceSoapClient();
scIpClient.GetIpCompleted += new EventHandler<svChat.ServiceReference1.GetIpCompletedEventArgs>(IpService_Completed);
scIpClient.GetIpAsync();
}
private void IpService_Completed(object sender, ServiceReference1.GetIpCompletedEventArgs e)
{
this.ip = e.Result;
}
}
After Client is created, SetIp() is called, and Client.Ip is added to a text box.
Nothing happens.
Ip = null.
Service itselfs works, tested it.
Getting Ip by the above code works.
Gettings Ip via service through Silverlight App does not work.
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="GetIPServiceSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:2090/svChat.Web/GetIPService.asmx"
binding="basicHttpBinding" bindingConfiguration="GetIPServiceSoap"
contract="ServiceReference1.GetIPServiceSoap" name="GetIPServiceSoap" />
</client>
</system.serviceModel>
</configuration>
Any ideas?
regards,