Reputation: 558
I am working on a silverlight project which is a kind of virtual order. At the end it completes the input data and sends them as a mail . However you cannot send mails in silverlight because it doesnt allow .NET libraries which I use for sending mails (System.Net.Mail) so I am using a web service to send that mail . I use these functions :
In silverlight
public static void SendAsMail()
{
MailServiceSoapClient client = new MailServiceSoapClient(); // Client of WebService
client.SendMailAsync(output.ToString()); // output is the text of mail
}
In WebService
[WebService(Namespace = "http://www.mydomain.sk/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class MailService : System.Web.Services.WebService
{
[WebMethod]
public bool SendMail(string mail_text)
{
MessageBox.Show("connected");
// function which sends mail
return true;
}
}
I have added the MessageBox function to know if i have accessed the WebService. When I click the button which connects to WebService, it does nothing. I don't know how to fix this, please help
Thank you
Upvotes: 0
Views: 284
Reputation: 768
Make a service method that returns a value. Then you can use that to return any error messages or success messages
Upvotes: 0
Reputation: 44605
There is no way you can use a messagebox from a web service which runs inside IIS and has no user interface, this is not a windows application.
Try to replace messagebox.show with a logging method either in the windows EventLog or on a text file and check how it works.
Upvotes: 1