Silverlight and WebService
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 sta开发者_StackOverflow社区tic void SendAsMail() { MailServiceSoapClient client = new MailServiceSoapClient(); // Client of WebService client.SendMailAsync(output.ToString()); // output is the text of mail }
In WebService
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.[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 don't know how to fix this, please help
Thank you
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.
Make a service method that returns a value. Then you can use that to return any error messages or success messages
精彩评论